“Sexual orientation” is just the combination of your sex with the sex to which you are attracted. (And, of course, that's not the issue with transgender discrimination, anyway.) But, both sexual orientation discrimination (because sexual orientation is your sex + the sex of your preferred partner) and transgender discrimination (your sex plus you gender identity) are clearly discrimination based on sex:
A woman who is attracted to women is given adverse employment treatment not given to a woman who is attracted to men.
A man who is attracted to men is given adverse employment treatment not given to a man who is attracted to women.
A biological male who identifies with (or expresses stereotypical traits of) the feminine gender is given adverse employment consequences not given to a biological female who identifies with (or exhibits stereotypical traits of) the feminine gender.
A biological female who identifies with (or expresses stereotypical traits of) the masculine gender is given adverse employment consequences not given to a biological male who identifies with (or exhibits stereotypical traits of) the masculine gender.
In all four cases, the difference on which adverse treatment is conditioned is the target’s sex, QED, each practice is sex discrimination.
Hiding behind a word other than sex which means “the relation between the target’s sex and some other factor” doesn't change that the differentiating factor is sex.