but the idea that an entire demographic of people should have specific laws made about them based on the potentially illegal behavior of a few is indefensible.
Many women don't fear actual trans women; they fear pretend trans women. The real trans women are unfortunate "collateral damage" in protecting women from cis predators in skirts. Whether that trade-off is sound policy is a separate question from whether the "potential illegal behavior" of real trans women is the basis for the laws.
The Navy is not concerned with illegal behavior. It is concerned with mutual attraction between sailors in close quarters. Everyone thinks about the one gay sailor on the boat. They never talk about the 10% of gay sailors on the boat and the implication that sexual attraction and jealousies among them might have on unit cohesion. Sexual assault is hardly unheard of at sea, but consensual pregnancy is as much of an issue and, therefore, significant evidence that consensual sexual activity is a problem to be avoided. We can't have a Navy without straight men. OTOH, homosexuality is a natural condition that adversely affects unit effectiveness, like flat feet. There is no reason the Navy can't find it to be a disqualifying condition.
War has changed. We have made the political judgment to elevate the advantages of treating military service as a social device over maximum fighting efficiency. Race has a special place in American history, so one can make the judgement, which was made after victory in WWII, that racial integration of the Armed forces was a good thing for our overall social structure.
But the calculus is different for every other demographic, including women and gays. If we wouldn't billet men and women together on a boat, why would we billet gay men with straight men, where there might be unrequited interest, or with other gay men? The problem of pregnancies on Navy ships is bad enough. At least straight sailors can be segregated by sex to some extent. But there is no such workaround for gay sailors.
So maybe the title analogy isn't so apt after all. There may be good arguments for allowing trans women in women's spaces and for allowing gay men in the Navy. But refuting the straw man of "potential illegal activity" isn't one of them.