Maybe you’ve turned off WiFi Assist? It’s an option to allow mobile data to supplement WiFi.
If it's enabled, it tries as hard as can be to 'assist', even if the Wifi is bad, and it should have given up a long time ago.