Lost admin privileges on iMac
It’s going to be hard to offer blanket advice since if your hardware has failed, your backup is suspect, no amount of correct process will help. This would be a data recovery project which is very different than trying to recover from a lost password, admin database corruption.

Reinstalling the current OS from recovery should fix the machine enough to follow this guide to reset the password. https://support.apple.com/en-us/HT211672
If you know your backup is good, erase the Mac and then migrate back. https://support.apple.com/guide/mac-help/erase-and-reinstall-macos-mh27903/mac

If you ask a follow on question making notes which parts of the password reset process you chose and what step was the last you could complete, we might be able to offer a process change in case you missed a step or there’s an undocumented fix, but there are a ton of steps in the reset process, hard to guess where your case diverged from the expected path...