Hopefully Apple will announce better 2FA options for Apple ID account security in iOS 13 this WWDC
Currently for 2FA, a mobile number is required as a backup for 2FA Apple ID codes. There is no way to avoid this currently.
Hopefully Apple has been paying attention to the ever increasing high profile Sim swapping attacks and Number porting social engineering attacks on personal phone numbers.
Current mitigation’s people use at the moment include: setting up a separate phone number that you never divulge and use specifically for Apple ID 2FA, another option is to use a Google Voice number as its unable to be ported or sim swapped.
FYI: Facebook, Google, Microsoft, Amazon all support 2FA account security with App based authenticators or Hardware keys without the requirement of a Phone number.