If it's not actually treason, it's borderline and deserves investigation. It depends on how you interpret the need to uphold the constitution to ensure a peaceful transition, irrespective of who is the current occupant of the office of the President of the United States, and legal requirement for the military to reject illegal orders (
under Article 90 of the Code of Military Justice).
What's more alarming is this is
preparation for the event that the military would need to defy Trump giving an illegal order, either to attack another country unprovoked, or to deploy the Armed forces on US territory (
under the Insurrection Act).
The bottom line is that process for
using nuclear weapons by an US president is predicated on speed, with a decision time in the matter of minutes with no real ability to oppose such orders. The system wasn't designed to give the military opportunity to refuse an order and it was assumed that an unstable president would have been removed by the 25th Amendment or Impeachment. If Trump had (hypothetically) given such an order to launch a first strike on China for example, Miley options for refusing it were limited and required basically unanimous support from subordinates to send a message to everyone further down in the military hierarchy not to treat the orders as legitimate.
I'd lean towards putting Miley on trial to ensure the law is upheld, as short of forcing Pence to enact the 25th Amendment (or perhaps someone further down the line of succession), this
sounds as close to transferring the power to the military as you can get for the duration of the last weeks of Trump's term. The 25th Amendment and Impeachment were meant to prevent this situation for happening but were not used. We got lucky that this isn't even worse. What makes Miley's behaviour so significant is weighing the unorthodox nature of the decisions in a chain of command vs the risks of what might have happened had he not taken those steps. It's a grey area at best that the constitution was never designed to cover. This kind of scenario belongs in works of fiction, but here we are.
[Edit. Here are some more extracts from the book in the video below. As someone in the comment sections put it: "Military tries to prevent a war and is accused of criminal behaviour. Welcome to flat earth!"]