2 things:
1) Never let the default installation login credentials be a Microsoft Account, always create an offline local user / admin account.
2) Have a bootable Knoppix LiveCD device (USB / CD / DVD) to be able to reset local passwords. Works up to Win10, not tried it on 11.
You will never be locked out of a Windows system again.