Don't think it is illegal!
Instead of being illegal. I think what they mean is you can't be Trans and be in the Military. Which is fine with me I already did my time as Trans. Dress the way you want at home. Same as the way you want with in reason at work. What you know and what they don't know will more than likely keep you okay. Be discreet. You can do it. But don't take my word for it I don't know anything. Smooth sailing from now on.
I will be retired for twenty years next year. Think stuff like trouser socks instead of and you can make it. There are probably other things that will work to.
Tess