Why do the photos on my iPhone 7 seem to be losing quality?
The answer is in the Optimize iPhone Storage setting.

When enabled, only thumbnails of photos are stored in local storage. By viewing a photo, you are downloading a compressed version from iCloud. There is no quality loss, since the original photos are still accessible by loading them one by one or turning this optimization off.

I believe that iCloud Photo Library uses some kind of lossy compression.