Rank matters in Military.
A lot.
Laws should matter more.
We are a nation of laws not of men, rank, status or anything else.
Everyone is equal under the law in this country (or damned well SHOULD be) and that includes the military.
UCMJ gives the judge precedent within his own court - independent of the rank of any officer - same ability applies to civilian court judges.
Contempt of court is a very special power that judges hold in regards to the courts to ensure proper the law is upheld, rights are properly treated, and no blemish is put upon the proceedings.
It’s rare - but it’s happened before.