To play the devil's advocate: A minor child cannot provide consent, and that's kind of the problem.
---------------
Edit: To give the idea a little more flesh:
It's the duty of the of the State to represent the well-being of a child, if the children's parents are unable or unwilling to do so.
Let's be hypothetical here and imagine a place where a majority of the People of a State believe "gender affirming care" is not in a child's best interest, then you could have a situation where the State is compelled to do what was done in Texas.
Are the majority of people in Texas of the belief that "gender affirming care" is not in a child's best interest? I don't know, but it seems plausible.
Is "gender affirming care", in truth, the best thing for a child? I don't know. I don't know how to even start to approach that question in an acceptable way.