It's clear that TNG learned from TOS's mistake. The chain of command was clearly established early on in that show: Picard (captain), Riker (first officer), then Data (second officer). After that, the chain of command gets a little fuzzier.
And in that show's first season, Picard left the ship under the command of Geordi in The Arsenal of Freedom. Geordi also refused to relinquish his command to an officer who outranked him, Lt. Logan, saying the only officers who could relieve him were Picard or Riker.
I can think of one ep in TOS where it's clearly established that the chain of command is Kirk, then Spock, then Scotty. In Let That Be Your Last Battlefield, those three, in that order, are required to authorize the self-destruct sequence. (Again, it was better in TNG when it only required the captain and first officer.)
Red Ranger
And in that show's first season, Picard left the ship under the command of Geordi in The Arsenal of Freedom. Geordi also refused to relinquish his command to an officer who outranked him, Lt. Logan, saying the only officers who could relieve him were Picard or Riker.
I can think of one ep in TOS where it's clearly established that the chain of command is Kirk, then Spock, then Scotty. In Let That Be Your Last Battlefield, those three, in that order, are required to authorize the self-destruct sequence. (Again, it was better in TNG when it only required the captain and first officer.)
Red Ranger