The Boston lawsuit said Trump’s order directly targets transgender Americans by attempting to deny them legal recognition under federal law and to strip them of long-established legal protections.