When you reset all settings or restore a backup from iCloud (or set up a device as new), the Keychain / iCloud and local USB trust pairings are removed and you should be prompted to trust the Mac when it connects to your iPhone.
After the trust setting dialog pops up (if you are connected over USB), there is now a screen that asks you to enter your iCloud password to finish setting up the iOS device. I have not seen the follow on passcode/password page ever until today. In my case, it wanted the passcode on another iPad and not a Mac ( I have two iPads, an iPhone, Apple Watch, two Mac connected to my iCloud account as primary accounts / keychain sync enabled on all).
Enter Passcode for Other iPad
Access to your account is protected by the passcode for "iPad". Your passcode is encrypted and cannot be read by Apple.
In my case, the iPad in question is named iPad Air 2 and there's a blue link with the text "Forgot iPad Air 2 passcode?" Tapping that lets me select another device to enter a passcode. I then selected my Mac Pro and the text changes to:
Enter Mac Pro Password
Access to your account is protected by the password for "Mike's Mac Pro". Your passcode is encrypted and cannot be read by Apple.
I do have two step authentication enabled for my iCloud account so this seems a legitimate change that Apple has implemented recently to secure backups and/or joining a "new" device or OS to the keychain syncing / trust chain.
After entering the password, there was a long delay (the iPad screen went dark) and the next step was the iCloud Keychain dialog which also was slow to continue when I tapped that.
Best Answer
I think that you've selected to use your iCloud account, so by verifying your Passcode with you iphone Apple added a security to be sure that you are the owner of your iCloud Account. This will allow your Mac to synchronise your data from iCloud.