Hi there, congratulations that you have resolved the trouble that Mac is stuck on the login screen after disabling SIP by erasing the hard drive and reinstalling macOS. Actually, there are also other solutions that you can try before performing the hard drive formatting to avoid the backup work: bypass login items at startup, boot your Mac into safe mode, and reset NVRAM/PRAM.
Hope this answer helps when you deal with the trouble that Mac stuck on the loading login screen on your device. Take care~