I've been getting around this with an app from F-Droid, "Automation" by Jens Schröder.
WiFi turns off after 10 minutes of not being connected to anything.
Everyday, a task runs between 5PM and 12AM every 30 minutes to turn WiFi back on.
On Saturday and Sunday another task that does the same thing from 9AM to 5PM.
Works for me.