These comparisons you're trying to make don't actually work. From what I understand, this is based on health, not being discriminatory. Unfortunately because it's towards a minority, it's automatically considered discrimination. However, transgender people or those who identify as such and are on hormones are 100% dependant on those hormones to be the gender they identify with, and the risk of being unable to access these medications is high. Without the medications they are, technically, unstable and therefore unsafe. This is not the same situation with homosexuals, nor with women. If anyone from these 2 groups were dependant on medication, they would also be denied.
On another note, as unfortunate as it is, I believe that gender dysphoria is still considered a mental illness in the eyes of the government (someone can correct me on this if I'm wrong). So alongside the argument of being dependant on the hormone medication, they are considered to be mentally ill, and like someone who is otherwise in perfect health but is clinically depressed, suffers from anxiety, bipolar disorder, an eating disorder, etc, they would be denied.
Is it completely fair? No. Does it make sense? Yes. Is it discrimination? No, not necessarily, because if they hadn't announced it as they did, and perhaps announced instead that they were tightening up on military entry requirements, this discussion would probably never have happened.