If I understand correctly you are talking about hidden SSID.
In this case, I don't think the mechanism to connect to such hidden SSIDs can be controlled by the OS. The only solution/mitigation is to remove/forget these SSIDs in the phone's Saved Networks
.