Enable Two-factor authentication without being logged into an iOS/macOS device
The linked MacRumors article discusses your exact concern and solution in detail:


How to Set Up Two-Factor Authentication for Multiple Apple IDs on One Device



  As of February 27, 2019, Apple is requiring that all Developer accounts with an Account Holder role be secured with two-factor authentication in order to ensure that only the account owner is able to sign into the account.
  
  The requirement has caused some confusion among developers who have multiple Apple IDs, particularly those who use a dedicated Apple ID for their Developer account that is separate from their primary iCloud account used on their devices.


The solution to the problem requires you to login with your developer user account on a trusted device. This can be done by creating a new/temporary user account on a Mac, logging into iCloud with your developer Apple ID, activate Two-factor authentication when asked to and entering a phone number to receive text messages.

You can then proceed to setup an iOS device to receive verification codes without enabling other iCloud features. Go to Settings app → Passwords &amp; Accounts and add a new iCloud account. After authenticating successfully, choose not to enable any of the iCloud features and save the account.

This way you can have a trusted device setup to receive Two-factor authentication codes without logging out of your primary iCloud account on your device.