You can enable Wifi Assist on your iPhone to automatically switch to Cellular data when Wifi is weak.
Short of hammering the AP with test transmissions (oh no, battery life) when the connection starts to get below a certain level, not sure how it could solve this before the user attempts to do something.