I am NOT saying that the following is the issue happening with your phones.
A few years ago when the 4 and 4s were Apple's two offerings, there was an issue that caused me and a friend to have to have our phones replaced after using them for several months.
If I recall correctly, whenever we plugged our phones into the stock Apple charger , there would be an error message that popped up infrequently stating that the device was not compatible with the accessory being used. This message would normally disappear after a disconnect and replug.
Well, as time rolled on, the message would become more and more frequent until the point it would not go away any time the phone was plugged into the charger.
Took the phones back to Apple early on, but couldn't get the phone to reproduce the bug, and Apple's diagnostics claimed the phone was fine. So finally after the bug would pop up reliably, we took our phones in and indeed, Apple replaced them after exhausting all other avenues of repair.
In the end, there was no exact cause found, but we live in hot, humid South Florida and we suspect somehow the connections on the phone for the old school USB connection were corroding or something of that nature.