I think you missed a Captain in the TMP era ships. I believe like Scotty, McCoy at some point held the rank of Captain. Just not a Ships Captain. (Actually wasn't he further referred to as The Admirral in Encounter at Farpoint? Making him the only confirmed TOS era character to end his service career at that rank?)
Naval rankings and titles can get weird in real life, and even weirder in Trek (since like most SciFi they follow the time honored tradition of "making sh@t up in service to the story") most confusion seems to stem from the weird naming convention where the title Captain is used both as a Rank, and a somewhat indirectly related Command Position. Ship's Captain is a Command Position. It does not in fact require a Captain ranked officer. Smaller ships are typically Captained by Commanders. Hence Sisco was a Commander when he was the Captain of the Defiant. He was addressed as Captain when on board. In fact when he was promoted to full Captain rank he was largely promoted out and above the Defiant's Captains chair to take on a Theater War planning and command role. Leaving the Defiant to Dax or Worf. In the real world this is common in smaller ships such as Attack Subs or Smaller surface ships.
Similarly in a particularly large ship or crew there may be multiple Captain Ranked Officers serving as department or specialty heads. Modern Aircraft Carriers are the clearest example. Case in point there is a Captain in command of a Carriers Air Wing. He is not the Ships Captain. He is the Air Wings Captain. His job is what the planes do, not what the boat does. It's actually more surprising that a huge ship like the Enterprise-D, with a crew of thousands did not have a few Captain ranked department heads. Especially given the ships flagship status. Logic would dictate that Science, Engineering, and Medical could all carry a Captain at their head but under the ships Captain.
Also note that we have seen situations in Trek where officers above Captains rank are Captaning ships. Commodore Matt Decker comes to mind. He commands his own ship and has several ships in a task force under him. (Don't even bother trying to figure out how or where Star Fleet Commodore actually sockets into the rank charts. It's example A of "making sh@t up in service to the story")
Add to this that an Army or Air Force Captain is the Equivalent Rank of a Navy Lt Commander, Whereas the Navy Captain lines up with the Army Colnel. And you can see where the entire concept of "Captain" is enough to makes ones head hurt.