Looking under Settings/Apps and Notifications/Advanced/Battery optimisation/All apps, so I can try to turn optimisation off for whatever controls WiFi, I see hundreds of apps and system apps, but cannot see one which looks like it controls WiFi.
I guess it could be called something different.