Check this out
Android has a "keep wifi on during sleep" option
The options are "Always", "Only when plugged in", and "Never"
There is no "Keep wifi on during sleep only if wifi was already on" option. It will turn your wifi on for you if you weren't using WiFi before putting the phone to sleep.
if, for example, you have WiFi turned off and have it set to "Always", turning off the display will turn wifi ON
EVEN IF YOU EXPLICITLY HAVE WIFI DISABLED
this cuts off any current connections of course, because of a network change
Alternatively, if you have it set to never and happen to be using WiFi, the phone will turn the WiFi chip off when you close the screen, therefore changing the network and dropping current connections
Android will never not attempt to change the network when you put it to sleep.
You can either have 4g that switches to wifi at will if you're near a known network, or wifi that switches to 4g at will if you have service
Both when you shut the screen off of course.
The only way to stay completely consistent is to only either use wifi or 4g exclusively, or change the “keep wifi on during sleep” option back and forth depending on what you're doing, likely multiple times a day.
This is why professionals use iOS. There's so many little inconsistencies in Android and Linux, riddled through the software like pores in a sponge. And you have NO WAY OF KNOWING how many are impacting you WITHOUT your knowledge.