To be fair, that the gay marriage example does require a little more examination. The argument is that if everyone had the right to marry somebody of the opposite sex, regardless of their sexual orientation, then it appeared that everyone was being treated equally but in practice they were not. For gay people, this right was of little or no use to them, because if they could only marry someone of the sex they were not sexually/romantically attracted to, they could not participate on an equal basis in the institution of marriage in a way that meets the purpose for which it is generally intended and used in a modern Western society.
In using this as an analogy to the situation of people who identify as transgender being able to access facilities intended for the other biological sex, there are a few shortcomings. The key one is that where we consider it appropriate to segregate by sex, in no case is the purpose of that segregation to validate the gender identity of those using the facility (or engaging in the activity). Even more so when gender identity is meant to be on a spectrum between masculine and feminine, so any facility could contain people with varying gender identities. Therefore, having a particular gender identity does not inherently prevent anyone using a facility for its intended purpose.
Furthermore, allowing gay marriage does not in any way interfere with straight people being able to have an opposite sex marriage. In contrast, changing facilities from segregation by sex to segregation by self-declared gender changes those facilities for everyone. If the purpose of the segregation is to ensure safety and privacy from the opposite sex (especially important for women) then removing the right for women to object to the presence of males (who must be assumed to be women regardless of appearance) in changing rooms does interfere with women using these facilities for the purpose for which they are intended. Nobody has produced a rational argument as to why it is more important to restructure facilities to allow one group to use them for a purpose for which they were not intended, at the expense of another group being hindered in using them for their intended purpose. None of the so called analogies are actually analogous to this.
If a transgender person has medically transitioned or does not present as their biological sex, that is a stronger argument for saying they can’t be expected to use the facility for their biological sex (because they could be perceived as using the wrong facility, subjected to harassment etc). But that isn’t what the argument is about. It is not about making an accommodation for people with a rare characteristic. It’s about restructuring aspects of society to conform to an ideology (that subjective gender identity trumps biological sex). But nobody ever advances any rational evidence-based argument to support this, because there isn’t one.