It is all a big fanwank. Star Trek has misled on a number of issues related to military leadership and command. If you are drawing your notion about what happens in the military because you saw it on Star Trek, you should probably look further. Simply put, rank is not omni supra what determines who can be the CO or XO of a naval vessel. Permantently pushing up the next in line when there is an empty spot was always just a feel good measure for the fans that did not match what tends to happen. There are plenty of contrivances and bad dramatical choices that brought us to the point where Tilly could be considered an XO. I'm more than willing to note what they are. They are the same types of choices that made us feel good about Nog skipping the last two years of the Academy, even thought that's not what really happens. Training matters. Those who don't have it, those who have only been the OOD, don't get to become COs or XOs. (The only real exception is someone who comes from the Merchant Marine out of respect for that branch, but they don't get to command combat vessels.)