Apple Two Factor Authentication: why verification code popup don't display?
When you restore a device, it is removed from the trusted device list in case you want to sell it. Here's how you can add the iPhone back to the list:

Go to appleid.apple.com and sign in. 

Under security, go to Trusted Devices. 

Refresh devices then follow directions to confirm your device. 

Remove your unused versions of devices. 

You will only be able to receive codes on your iPhone, not your mac.