This isnt strictly true. Although gay/trans rights are not recognized by law, there is no real enforcement of the law itself. People are to some degree free to do/be as they please. As for non-muslims, it hasnt ever been an issue - there are churches and hindu temples around as well.
Source: lived in dubai for most of my life