When 2FA is created from Mac a trusted device is essentially to be verified in the account to complete the account it could be an android phone / not aways an iPhone is used the code will appear on it , its your choice to create a code from Mac system preferences see some articles Two-factor authentication for Apple ID - Apple Support
Get a verification code and sign in with two-factor authentication - Apple Support
Use two-factor authentication for security on your Mac, iOS devices, and iPadOS devices - Apple Support
Get a verification code on a Mac, even when it’s offline
If you can’t receive a verification code on your phone or trusted devices, or if none of them are available, you can get a verification code in Password & Security preferences, even if your Mac is offline.
Important: When you receive a verification code, don’t share it with other people.
- On your Mac, choose Apple menu > System Preferences, click Apple ID , then select Password & Security in the sidebar.
- Click Get Verification Code.
- Write down the verification code or enter it in the notification, then click OK.