Apple introduced this very feature in iOS 9 https://support.apple.com/en-us/HT205296
I've never really had time or interest to investigate how well it's implemented, admittedly. It caused some consternation among those with crap data plans at the time, who where understandably upset when the iOS 9 update enabled the feature and lead to unexpected bills.
I recently swapped out the piece-of-junk router from Comcast with a decent router, and it made a tremendous difference. Doesn't solve the issue when using other people's Wi-Fi networks though.
As far as I can tell, this comes down to two problems: the most obvious technical challenge is the difficulty of detecting soft failures rather than hard failures. What they need to implement is a hard timeout which resets the connection state if the remote end fails to respond correctly within a set interval. I encounter this regularly commuting on the subway or taking underground tunnels between buildings; toggling airplane mode is the only way to get it to accept that the base station (WiFi or cellular) it was talking to 1500 feet back is never going to start responding.
The social problem appears to be that nobody considers this a keynote demo feature and so it hasn't advanced beyond iOS 1.0 despite years of bug reports.
I would be happy with any kind of reliability for a mobile chipset in reasonable radio conditions. Too often, I have to turn off WiFi to get basic connectivity happening. 4G/LTE connections are way better. It would be nice if Apple detected a bad WiFi connection and fell back to cell, but it seems they haven't figured out that trick yet.