Don't stop transgenders from enlisting. Just make them sign an agreement that they will be fully responsible for their own medical expenses relating to their condition and the military will not help them cover any of the costs. Under this agreement, they will receive the same basic medical care any other soldier would receive, just no hormonal treatments. If they don't agree, they can't enlist. If they join and attempt to renege on the deal, they will be released from service and given a dishonorable discharge.