If they are being discharged on medical grounds, I see no problem.
If they are being discharged simply because they believe they are the opposite sex, that is wrong.
If service personnel who claim a special identity are deployed in regiments (or whatever the American military terminology is) according to their sex, and use the facilities of their sex, don't rely on drugs or request surgery, I can't see a problem with them staying on. Presumably they are still trans.
If being on medication means you are not deployed on frontline service, and if it's the case that numbers of new recruits claiming a special identity has increased since the military started a policy of funding hormones, surgery, etc, I wonder if the US government is trying to avoid a situation similar to the one faced by the Spanish military. In Spain, benefits aimed at increasing female participation have been taken up by males, most of whom were already in the armed forces. This has meant increased cost to the government without a commensurate increase in personnel.
In the case of the US military, they could be facing increased costs (from funding transition) without a commensurate increase in active personnel.
The armed forces probably offer decent pensions and benefits. Perhaps people are joining up with an eye to not only getting medication and surgery paid for, but also knowing they will not be exposed to the risks that frontline personnel will face. It's certainly possible.