Need to know if I've bought a used iPhone? (multiple Apple IDs connected)
I remembered I had this issue when I was restoring an iPhone 5s backup to the iPhone 6 I bought at launch in 2014. I had a string of unknown email addresses pop-up asking for passwords to enable store purchases. Obviously the phone could not have been used or stolen as I received it on launch day directly from Apple.

The issue is that content originally purchased from an iTunes store was obtained from other people and on your prior device at the time of backup, such as music, eBooks or videos.

In turn, when you make a backup of your device, for purchased content iTunes/iCloud doesn't store the content directly in the backup. It simply logs (essentially) the content ID and the account used to purchase it. When you restore a backup, it prompts you to login to each account that the backup knows about so it can re-download the purchased content.

If you bypass that password screen for the unknown email, you will simply get an error message stating:

Some items could not be downloaded. If they are on your computer, you can restore them by syncing with iTunes.

After the restore is completed, sync with iTunes to add the content back directly from your computer.

The device is not stolen or compromised, nor is your Apple ID.