That is what happened in early WWII.
An ‘unwritten law’ basically said if I were Senior to you and we were both Line Officers you - for the most part - would not be allowed to ‘advance’ above me.
So when a ‘slug’ was a CO of a ship, it was more expeditious to just put him on a staff, which in essence kept him Senior to his replacement.(EGO!!!)
The real ‘monkey’ wrench came in when the Non Acadamy Officers were given command...
That was a problem early on where ‘former’ Masters of Commercial Ships were way down the pecking order from the Regular Navy types...
Seniority considered basically EVERYTHING from USNA...year graduated, class ranking etc etc
I was Army Artillery. My CO was West Point, son of West Point. He was made an offer he couldn’t refuse. My unit was a bastard unit. My CO reported to nobody. We had no chain of command above this 2d Lt who quicky rose to captain.
We were a bastard unit due to the need for plausible deniability. Remember what the Kent State riots were about? Allegedly expanding the war from Vietnam into Laos and Cambodia. Well, 2 and 3 years before the Kent State riots, my unit was in Laos, throwing beach balls out of the 8” and 175 guns onto the “Ho Chi Minh trail”. But we could not get caught and if we were caught, the blame would stop with my CO as there was nobody above him. We were truly a bastard unit.
We had an XO Lt who probably was ROTC in a Cracker Jack college. Our guns were encamped near the bottom of a valley with steep hillsides. ROK forces were camped up the hillside.
A Laotian Forward Observer called in a strike. XO ordered the angle of the guns. The enlisted all objected and explained that they had to shoot up and over the steep hillside. The XO stated that he did the calculations and the ideal route with the least powder would be what he commanded... and gave a direct order for his angle.
The enlisted obeyed and hit the hillside and made a lot of ROK angry. Minor injuries, nothing serious. But the ROK could not understand why we were shootng at them.
A Laotian Forward Observer fled the the US, became National Chair of the Laotian Republican Organization headquartered with Family Tax Payer Network where I hung out. And he ran the largest Bhuddist Temple in NW Chicago Suburbs, delivering all those Laotian votes for Rauschenberger, Fitzgerald and the FAB 5. We shared some tales on life on the trail.
Even though Communist Vietnam trended less Communist later, Laos stayed very Maoist/Stalinist. The National Laotian Republican Organization was very disappointed that Republicans acted like Communism was not longer a problem. They felt written off.