Two-factor authentication "You have sent too many codes to verify your phone number."
Wait for 8 hours and then try again. If the codes dont work the 1st 2 times, click didnt receive code and try another offered method (like text me, call me, didn't receive code). It sounds like you have a software issue. Maybe a backup and restore can help in the long run, but for now just wait the 8 hours.
That is not a software problem that is a problem of the codes not sending promptly from apple and the user keep hitting "didnt receive code" or "send new code"
Contact apple support in this case. When you can’t resolve a failed log in, eventually your account will be locked to protect that account and it’s best to get support from the vendor to review your specific lockout and settings.
They would be able to quickly get a support engineer to look at the server logs and diagnose the geographic block or other system issue you describe.