Officials in Utah said the same thing when they passed their own ban on gender-affirming care for minors—right up until their own commissioned study found it was beneficial! Nonsense from SCOTUS.
Important bit of Thomas's concurrence: "There are particularly good reasons to question the expert class here, as recent revelations suggest that leading voices in this area have relied on questionable evidence, and have allowed ideology to influence their medical guidance."