Perhaps Starfleet cannot afford officiers of the rank of Captain and qualified not to command a vessel?
But why?
A Captain doesn't need to command a starship, just as a starship commander doesn't need to be a Captain. Sure, it seems to be the most regular of protocols, for a person to take command of a ship as a Captain, but that's not to say that many officers who are ranked as Captain, don't spend a long period working at non-starship command assignments.
I don't see why Starfleet would hold off promoting somebody to Captain, just because they might decide not to pursue starship command, or there wasn't a suitable ship available (surely a person's experiences and skills dictates the kind of vessel they command? It would be illogical for an officer, whose experience lies in the field of battle tactics, starship combat and defensive manuevers to be given command of a science ship).
At the same time, why promote somebody to Captain, just because they happen to command a starship. Dax was acting Captain of the Defiant, whilst still a Lt. Commander. Matt Decker captained the Constellation, whilst ranked as a Commodore. Let's not forget that Sisko, first received command of the Defiant, whilst ranked as a Commander.
It all comes down to the fact that many instances in Trek, (live action, in particular) have stressed that a person must be a Captain to command a strarship.
I'd rather that Star Trek mirrored real-world military sometimes. In the sense that in real-world military, rank is greatly determined by years of service. You'd be hard pushed to find a traditionally promoted General (not some dictator who has bestowed the title upon themselves) that is under the age of 45. A person can be given command of their own units, vehicles and entire squadrons sometimes, regardless of rank. It all depends on competence, and their suitability for the role. That's how it should be in Star Trek, rather than people being elevated to Captain in their late 20's, (Ezri) because they happen to command a starship.
ETA: I also never liked the idea that Kirk couldn't command the Enterprise, because he had accepted promotion to Admiral. The promotion in rank, shouldn't mean having to accept a desk job, rather the "desk job" should be seen as a job that only an Admiral (or member of Starfleet Command) could take on. In this scenario, Kirk could have simply declined the promotion to Chief of Operations and carried on serving as commander of the Enterprise.