I know of 2 approaches to change network settings.
The first uses UI actions to choose the required network setting.
The second, not available on all makes of phones, uses system settings. I have never been able to use this method and hence use the first method.
May I ask you a question?
Why are you switching from LTE to 3g when a WiFi connection is established, assuming I've correctly interpretated your request?
I just turn off mobile data when WiFi is connected. Also switching to 3G you will lose VoLTE, if supported, for clearer voice calls.