There are sensors that show water ingress into the iPhone.
Maybe in a perfect world a iPhone gets dropped into water and survives. But if that iPhone had been dropped several times beforehand or otherwise treated poorly then that changes things.
As for aftermarket stuff, there have been numerous cases where aftermarket chargers as an example had caused fires. A lot of variables in play here.
At least with my Apple devices, I almost always use a cable with Apple's approvals. They can be remarkably cheap, and I suspect Apple doesn't really make money off of the "Made for iPhone/iPad/IPod" licensing. Not necessarily for power sources though, but I'm rather particular about what I use even if it's not something with a USB or Apple certification.
The biggest issue is that the seals are made with adhesives. They dry out over time and as you note that might be degraded through wear, use, previous water exposure, etc. It's certainly not going to be like a diver watch using positive silicone seals.
The easiest thing to show water exposure is right there at SIM card slot. Turns red when exposed to water. Apple will refuse to service any device that shows any liquid contact indicator has been exposed to water, or it's been removed. Even without any damage. I haven't seen that turn red on any Apple device, but I bought an Amazon Fire HD 8 for my kid and once that got wet. Gave a message that it wouldn't charge until it sensed no more moisture at the port. But it still worked and eventually the warning went away. But I'm thinking it was probably logged in its internal diagnostics and would have been an issue in case of a warranty claim. I think Apple has a similar electronic moisture sensor.