It does seem to be a problem, having the same characters staying with a ship for decades and not letting them advance further. Look at the TOS crew, you would have thought that after at least three decades of service the likes of Uhura and Chekov would have been given their own commands as well.
Well, it's not realistic to expect starship command to be the end goal of every
officer's career path. A military hierarchy is basically pyramidal; the higher the rank, the fewer positions there are available. (After all, a starship has hundreds of crewmembers, sometimes more than a thousand, but only one captain.) So only a small percentage of people in the service, probably less than one percent, would reach command rank; the rest would just keep on serving at a lower rank until they retired. And by the same token, presumably, not every career path has
command as its end goal. There's evidence that the command track is a specialized career path within Starfleet, one you have to choose to pursue in order to become eligible for a command post.
(Although the novels haven't done much to dispel this misconception that every officer reaches command rank eventually, since they've established both Uhura and Chekov as admirals in the 24th century, meaning that all of the big 7 have reached at least captain's rank. Which is just as unrealistic as having them all serve together on the same ship for over a quarter-century.)