Automatic Wi-Fi connection after formatting: how possible? I have a MacBook, FileVault turned on. One day I formatted the internal SSD entirely (not just one partition), and started 'internet recovery'. The MacBook connected automatically to my home router's Wi-Fi, which is WPA2 password protected. It never prompted me to enter any username, SSID, or password.

If the Wi-Fi credentials were stored in the internal SSD, then the credentials should have been erased already. Even if they weren't erased because I messed up the formatting, they were encrypted with FileVault, so the MacBook should not have been able to use them without asking me for the FileVault passphrase first.

I'm so puzzled.
I think you have provided your Apple ID details (including the password) prior to the internet recovery. Thus, this is happening due to iCloud Keychain. (Which stores your passwords in the cloud and use them whenever it needs). If that is not the case and if you sure that the connected wifi network has WPA2, it is suspicious.