As long as you’re using an Apple trusted device, the default method for getting codes is via encrypted iCloud notifications sent over the internet. Apple’s default system of sending codes does not use any telephone system nor any text message system. The deliberately designed 2FA to not use any telephone system as default for codes because of the inherent less secure nature of sending anything by SMS or voice call. iCloud notifications use Apple’s own internal hardware and systems, are end to end encrypted and are sent via the internet.
The SMS or voice message option are available as backups, not as the default. They are there to be used when you don’t or cannot get a code via iCloud notification. And you cannot change the default use of encrypted iCloud notifications as it is far more secure then using texts or voice calls.
If you don’t have any trusted Apple devices linked to your AppleID, then the telephone number becomes the sole means of sending codes.
Get a verification code and sign in with two-factor authentication - Apple Support