The transphobia predates Trump. North Carolina's HB2 was in early 2016 (i.e., before Trump's first term), and the ballot initiative to repeal the Houston anti-discrimination ordinance (which was defeated by a campaign that had transphobia as its centerpiece) was in 2015.
The state (and local) laws are a result of a multi-decade push by heavily funded right-wing organizations to put right wing candidates in local and state offices. These organizations looked for a group that could be easily demonized, and they picked trans people. We're a "wedge issue." Just as in Houston in 2015, they demonized trans people to distract voters from the other awful stuff they were doing. And they're still doing it.
In Trump's first term, he wasn't able to do all that much damage, because he's an incompetent. In this term, he's teamed up with powerful, well funded organizations like the Heritage Foundation and the Project 2025 people, who are the ones making the policies. And they won't go away when Trump is gone.
I remember, when same-sex marriage was legalized by the (US) Supreme Court, a lot of "LGBT" organizations closed up shop, because the people running them believed they had won the battle they cared about. Unfortunately, they forgot that these battles are only won for a short time. Every progressive issue has to be refought every generation, if not more often.