To cover all your bases, you might want to reach out to Apple Support over the phone and have them guide you. That's what I did, and the incredibly helpful 'senior advisor' had me do this:
Start in 'Safe Mode', erase the disk using 'Disk Utility' and then use 'Internet Recovery'. This got me to 'Sierra' since that's what I had originally. (I tried to reinstall High Sierra, and it wouldn't work) From there you decide which OS you want to install (I went with Monterey found in the 'App Store'). After installing it, and starting it successfully with a temporary ID (don't try to recover any files yet) -then restart the computer in 'Safe Mode' again. If you have the option to re-install the updated OS you just installed -that's good. Still in Safe Mode, erase the disk again. Then reinstall the OS again. After that, when the updated OS starts from scratch -use 'Migration Assistant' to recover everything from 'Time Machine'. Sounds like a lot of repeating, but it did the trick for me. Good luck.