I don't know if this will apply to everyone.
I had the same routing problems and I found that the "Access Point Names" in my T-Mobile Galaxy S5 was set to use IPv6 protocol only.
It was forcing IPv4 through IPv6 and as a result the IPv4 gateway was being overridden by the IPv6 network.
My servers gateway was being replaced by T-Mobile's gateway almost immediately.
This can be found in Settings, Network Connections, More networks, Mobile networks, Access Point Names.
Name : T-Mobile US LTE
APN : fast-mobile.com
Proxy : Not set
Port : Not set
Username : Not set
Password : Not set
Server : Not set
MMSC :
http://mms.msg.eng.t-mobile.com/mms/wapenc
Multimedia message proxy : Not set
Multimedia message port : Not set
MMC : 310
MNC : 260
Authentication type : None
APN type : default,mms,supl
APN protocol : IPv4
APN roaming protocol : IPv6
Turn APN on/off : APN turned on
Bearer: Unspecified
Mobile virtual network operator type : None
Mobile virtual network operator value : Not set
Since you can't edit the stock APN, I added an APN, duplicated the values from the stock one.
I used a different "name" and changed the "APN protocol" to "IPv4".
I tried "IPv4/IPv6" but the GW overwrite still happened.
Name : T-Mobile US LTE IPv4
APN : fast-mobile.com
Proxy : Not set
Port : Not set
Username : Not set
Password : Not set
Server : Not set
MMSC :
http://mms.msg.eng.t-mobile.com/mms/wapenc
Multimedia message proxy : Not set
Multimedia message port : Not set
MMC : 310
MNC : 260
Authentication type : None
APN type : default,mms,supl
APN protocol : IPv4
APN roaming protocol : IPv4
Turn APN on/off : APN turned on
Bearer: Unspecified
Mobile virtual network operator type : None
Mobile virtual network operator value : Not set
I am looking into enabling IPv6 to see if that will correct the overwrite as well.
Unfortunately the guides are a little fuzzy on IPv6 setups.