Sometimes the right thing to do isn't always the popular one. So that's part of it. Sometimes, too, the job of a government in a democracy is to protect those who either don't have a vote, or who don't have a large enough one, from those who do. Whether or not the two examples cited fall into this category is another matter; although I'd say that not only is "in thrall" misleading, it's probably also a mistake to conflate the two.
They do have one thing in common, though, which is that the "extreme" elements of both trans people and those who care about the environment all too easily get mixed in with the more mainstream versions. On Climate Change, for example, there's almost universal agreement now that we should take steps to reduce our impact on the planet in multiple ways, and the sooner the better, so it's hardly an extreme position to care about this.