I found this by searching which says it can be done but that's old,
It's in Settings, Connections, Wi-Fi, top right Advanced, Intelligent Wi-Fi, and then Turn on Wi-Fi automatically
Below that there is also an option to look at your "Wi-Fi control history" which says "View apps that have turned Wi-Fi on or off recently" so it sure looks like apps can turn on wifi automatically and then shut them off.