The statute says "sex" not "sexual identity." From the opinion: "The parties concede that the term “sex” in 1964 referred to the biological distinctions between male and female."
Instead of enforcing the law as debated, written and passed, SCOTUS instead re-wrote the statute so that "sex" not only meant "biological sex" as it meant when the law was passed. Now, by judicial fiat, "sex" also means "the state of mind of a person with sexual identity disorder to such a degree that they cannot or will not recognize their biological sex." SCOTUS increased the scope of the statute beyond what Congress considered. That sounds like judicial activism to me, in which SCOTUS makes law things that Congress never contemplated.
Obviously, I will have to read the opinion. There may be nuances I have not considered. But, from the article, it seems like he was legislating from the bench.