The way to solve the gender/sexuality based toilet access conundrum is to use a proxy. This should be the way you are dressed. Irrespective of gender or sexuality if you dress as a woman, you should have access to the women’s toilet and vice versa for men. Transgenders could also be conveniently accommodated using this metric.
Of course this still does not solve the problem of the closet gay/lesbian persons who hide their sexual orientation by dressing according to their gender, because the law in India criminalises them and social norms still discriminate against them.