This is besides the issue of putting trans people in high-stress situations. Putting a group of people known for high suicide rates and attempts into a high-stress environment is not wise.
Nor is putting them into an environment where others may put their own lives in their hands.
It is a decision that has nothing to do with cost cutting, nor discrimination — if you want a military to operate on a high level, these people need to be able to depend on others with lives at stake. It is a level of trust and stress that goes beyond worrying about smaller exceptions (even if some trans, or even quite a few — are capable — it is not worth the risk when they show dramatically higher rates of issues).
Sure, most personnel do not enter those situations — but a military needs to be capable of doing so, or it is not a military at all.