With Pete Hegseth confirmed by the Senate as Secretary of Defense, there was no chance the military was going to be able to resist anti-trans policies.
Hegseth himself has long been an outspoken hater of trans people. Given the military's strict hierarchy and its tradition of resolutely honoring civilian control (by the president, Secretary of Defense, and secretaries of the individual armed services), the outcome is unavoidable.
During Trump's first term, he didn't make political appointments that would have assured the outcomes he wanted. He listened to political advisors and appointed actual experts to most posts.
He learned.
By appointing Hegseth, an extreme right-wing ideologue with no military management experience, Trump is getting what he wants, and military leadership find themselves in an impossible position.