I just had this happen to me. My 13mo old was messing with my phone and re-entered my security code wrong too many times and Poof! My phone was erased. I have work email on it and their security software requires this function. Well lo and behold I couldn't access my phone to get the 2 step verification code. I started the Account Recovery process by getting on Facebook Messenger (on my PC) and having the code sent to my mom's phone. But, after reading this thread I panicked about how long it might take. I have no landline. Soooo, I decided to setup my phone and create a brand new Apple ID. I had a junk email address I used (or you might also have to make a new email account too). Then once I could get into the phone, I could see all the codes in the texts!!!! Sooo, I went to icloud.com on my PC, and was able to enter the code! I immediately turned off 2 step verification! (Which also requires a code, in all I had to receive about 3 text codes). I was just going to add 2 more trusted phone numbers, but my husband isn't home, and you have to enter codes sent to the phone numbers in order to add them as trusted numbers. Once I was certain the verification was turned off, I master reset the phone (Yes, you have to agree to erase the phone, and it seems scary). Then when I set it up again, I used my previous AppleID (the one I'd been locked out of). It also asks you to turn-on 2 step verification when signing in, just click "Other Options" instead. So in about 2 hours once the backup is complete I will be back in business.
I am not sure if I'll turn 2 step back on. It seems a risky option when your only Apple device is your phone. If 2 step could be done by sending an email, that would be different. But it will only send codes, and only to an Iphone, Ipad, or Mac PC.
If I do, I'll be sure to add some more trusted numbers. But even then, you'd have to be able to get those codes without using your phone to contact the owners of the trusted numbers. So a bit of a pain. If you don't have access to another internet device (like another smartphone or a PC) I am not sure how you'd fix it without waiting for the Recovery process.
Hope this helps anyone else who stumbles on this thread in a frenzy, like I did.