Most major providers like GitHub, Google etc allow you to create "recovery" codes - so you can do a one-off login without 2FA using the code.
I've started getting a recovery code for each of my major accounts, printing it out, then literally putting it in a safe.