I think this is all tied to Advanced Data Protection, which has a minimum operating system requirement for all devices accessing your Apple ID. During the process, you may have removed a device that didn't meet the requirements from your account to force the enrollment to go through and now you're trying to sign in on the ineligible (or formerly ineligible) device.
What is confusing is when you do meet the requirement after enabling Advanced Data Protection, you can encounter this error which is telling you to upgrade to a version you are actively running.
Once you meet the requirements in the error message, you need to sign out of your Apple ID on the device giving you the error reboot and then sign back in.
In the case where you're doing a forced re-install (DFU, destroy APFS volume group, etc.), after signing out, be sure to also remove the device from your Apple ID before signing in. Once signed in you're device should show up in your account again.
And for the people that are not able to update to the required version in the error message, you'll need to disable Advanced Data Protection before your device can sign back in again, but ideally you need a newer device because the device is no longer supported in this security context.
I worded this solution to apply to both macOS and iOS/iPadOS because the security requirements are placed on your Apple ID by Advanced Data Protection.
To learn more about Advanced Data Protection visit Apple's support page on this topic.