Galaxy S5 unable to switch to 4GLTE when Wi-fi is turned off
I suffer from the same issue. I have discovered the following to work for me.

To prevent it occurring: Turning off WiFi Calling seems to work (It's the last item under "Settings >> Call"), if you have it available and on. I've not had to to resort to flight mode (see below) since disabling this.

Countermeasure when it occurs: Putting the phone into Flight mode and back out of Flight mode will restore the ability to connect to 4G, at least until the next time it fails after coming off WiFi.

Hopefully the above will help you avoid rebots.