Let’s assume for discussion purposes that (a) the previous owner performed the Apple-recommended “Before you sell or give away your iPhone” steps, including “Erase All Content and Settings” AND (b) this person is being truthful.
Assuming those to be true, it is difficult to see how this could happen.
Remember in iOS/iPadOS there is a different concept of users as compared to macOS, Windows, your favorite Linux distro, etc. On iOS you run as an account called mobile. On macOS you’d find the Photos library in /Users/yourusername/Pictures. On iOS photo data is on the data volume in /private/var/mobile/Media.
When you perform the “Erase All Content and Settings” operation, the key used to encrypt the data volume is deleted from the Secure Enclave. This renders all the data encrypted on the data volume inaccessible. Page 94 of the Apple Platform Security Guide has more detail.
For this scenario to actually happen, the encryption key would have to NOT be removed AND the new owner would have to essentially not write ANY of their own data to the iPhone. It seems impossible that the previous owner’s data would not be randomly overwritten by the new owner just using the device normally (installing apps, taking their own photos, etc.). Remember, there is no /Users/oldusername/Pictures hanging around, encrypted or otherwise. The old owner and new owner will both write their photo data to the same location in the file system. NAND flash will have data written all over it by the flash controller. I don’t see how the old owner’s data isn’t just randomly overwritten, encrypted or not.
Is it possible that in the event the encryption key is retained that the old owner’s photo data would be retrievable by the same iOS 17.5 bug? Sure. Photos would have to combine the old owner’s data encrypted with their key and merge it with the new owner’s data encrypted with their key and display it in the same library. I can’t see Apple writing code in the Photos app to do that.
If it is true, it’s catastrophic as the integrity of the system is completely compromised. It would mean that data beyond photos would be recoverable and that the implementation of the encryption scheme is worthless. Every “erased” device would be mineable for data. It just doesn’t seem very likely and it seems like something forensic experts, security researchers, jailbreakers, etc. would have previously found.