Unfortunately, it probably wasn't realistic at all, just a way for the script of The Deadly Years to dumb down an authority figure while allowing Kirk to show what an awesome Captain he was.
Makes me wonder about someone like Phillipa Louvois from "The Measure of a Man." She held the rank of captain but had no command responsibility aside from her role as a JAG officer. Was her entire career like that, or did she serve in Starfleet in some other way? If she held a law degree, it's possible she could have been a communications officer or ship's historian.
You don't need to command a ship to hold the rank of Captain. Its just the next rank after Commander. No doubt McCoy held the rank of Captain for a while, before becoming an Admiral. Louvois probably spent her entire career as a JAG officer. MA says she headed the twenty-third sector office of the Judge Advocate General office. Her command would be that office. With an organization as vast and diverse as Starfleet there are probably officers who have served little time aboard a ship.