Recently, I called Samsung tech support through the support app built into my phone (this will be relevant later). They told me that they have to follow a troubleshooting script, and had me reboot my phone into safe mode. They gave me the steps and the ticket number and told me to call back in later after seeing if this resolved the problem.
I gave it an hour in safe mode and the problem didn't recur, so I considered it fixed. I booted back into non-safe mode and called them back. They correctly determined based on this experiment that the problem is an app. Then they told me I needed to uninstall any non-essential apps on my phone to see if the problem goes away. I refused, and told them the problem existed before I ever installed any apps on the phone. More specifically, I said that some online forum posts made me suspect the problem was the Good Lock app, from Samsung. They told me they don't do any app support, but that if it's a Samsung app then they have a department for that, and I was transferred to that department.
A nice Australian woman's voice on the automated system told me I'd reached a department I hadn't talked to before, which was comforting. I talked to the person on that end for a few minutes and they said they also didn't do app support. They gave me the phone number for a third (or so I thought) department.
Calling that number brought me back to the first department. This time I told the person I was tired of being sent in circles. They again insisted that I needed to uninstall a bunch of apps, or do a factory reset on the phone. I again refused. I said I suspected a Samsung app of being the problem. They asked if they could remotely control my phone to see what I was seeing.
Now, recall to my mention of there being a support app built into my phone. It's called Samsung+ and it does a lot of things, including phone calls and voice+video chat with tech support, and a feature called Remote Access that lets me enter a code so Samsung techs can remotely control my phone. This tech asked me, instead, to go get a new app from the play store called Smart Tutor. I asked why she couldn't use the Samsung remote access system already built into my phone. She seemed to have no idea what I was talking about. I called the situation ridiculous, but did install Smart Tutor, and she managed to get access to my phone.
Now she looked at my app list and again said I had too many apps and needed to uninstall many of them. I opened the Good Lock app and she asked where I got this app. I tried to show it to her in the Play Store, which was fruitless because I had forgotten that it wasn't from the Play Store. While I was looking there, she repeated that this wasn't a Samsung app. I eventually googled for it and got reminded that it was installed by the Galaxy Apps system from Samsung. I opened Galaxy Apps and found Good Lock marked as Installed. She said she had no idea what that was, and that she couldn't help me with it. She said she could give me the number of a department that could.
I called that number and got a familiar Australian voice. This time the person on the other end let me explain the situation, and they also told me they had never heard of Good Lock. They said they only support a few Samsung apps, and not that one.
I ended up figuring out how to uninstall it on my own. This didn't actually solve the problem, so I'm still on the hunt for tools that can help me do that. I either need to find an app that will tell me which of all my installed apps have the permission to turn wifi on, or I need to connect the phone to a computer via USB and use adb logcat to look at the logs to see what's happening when wifi gets turned on and hope there's something correlated that I can track down. However, I no longer expect T-Mobile or Samsung to give me any assistance with that.
What blows my mind is that four different people at Samsung would tell me they've never heard of Good Lock and that they don't support it. Good Lock is one of Samsung's promoted apps in their own store, a cornerstone of the advertised user experience of the Galaxy S7 and other newer phones. https://news.samsung.com/global/good-lock-customize-the-way-you-use-your-galaxy-smartphone