I don't think Lemmy is immune to transphobia but you might be seeing less of it because there are less people overall and those are more strongly clustered, since not all lemmy instances federate with each other.
Usually instances decide to defederate when they notice too much unacceptable content coming from another instance. Thus, if you are on a more inclusive instance, they are likely blocking the parts of lemmy that are heavily transphobic. This makes Lemmy a safer space (for their users) but probably also gives the illusion that all of Lemmy is this inclusive.
But hey, that's just a theory. I don't actually know it that's the reason.