I have a Galaxy S5 and have the same problem with SMS failing when the phone is set to wifi calling. What is needed in the phone is an option to use wifi for calling, and a separate option for using cellular for sms as a short term solution. Currently, sms is lumped in with voice calling, but it doesn't need to be that way. Unfortunately, I think T-Mobile can only work on the technical problem that is causing sms to fail on wifi connected devices through their network. I think Samsung would have to modify the phone code for splitting SMS and voice into two separate options.
Overall, I do agree that this is a major headache. I've missed dozens of texts, with people thinking that I am ignoring them. A few times I've had 4 or 5 texts come in at once many hours or even days after they were sent. It's pretty ridiculous, and T-Mobile should definately do something to address it. I have to use wifi calling in some locations where the coverage is no good, but now I have to remember to turn it off when done or I might not get sms later at some other location if I have wifi access. I hate having to manage this, it sucks.