The real limiting factor is that a basic USB plug charger puts out only 2A while the iPhone’s peak draw at the same 5V can be well north of 2.5A if you’re using the GPU to its fullest.
However it’s not just the power cord that’s supplying current when you’re plugged in - if it were designed correctly there’s no reason those 2A couldn’t supplement whatever your battery is already putting out and only charge it with what’s left over. In fact, that’s how iPhones can stay at 90% while plugged in to a car charger, running GPS, playing audio at the loudest, and streaming some data in the background while some android models would discharge even while plugged in... but both would be dead a lot sooner if they weren’t plugged in.
The real problem is just shoddy engineering. Hardware isn’t much different from software: what all this boils down to is the equivalent of someone writing code that went into production across millions of devices around the world that assumed input x would always be greater than y and didn’t bother with any exception handling or bounds checking. And when that voltage/current combination coming in is insufficient.. an unhandled brownout exception occurs.
https://www.engadget.com/2014/07/14/junojumpr-jumpstart-your...
I actually have three absorbent glass mat batteries hooked up to a Noco Genius battery tender and a 1000W 12V inverter to provide battery backup for my sump pumps (long story). Losslessly converting that to 5V shouldn’t be too hard.