The suit is the latest legal challenge to the Trump administration’s policies that have sought to push transgender troops out of the military in his second term.