Keep in mind that the word 'starbase' can apply to ground facilities as well.
Those were even referenced on-screen.
As for the mushroom star-bases ...
My personal opinion on them would be a combination of a city/starship construction-repair/defense-offense facility.
Probably also has numerous other functions.
As for having only a few of them ... I wouldn't be so sure.
In fact, it could be possible that each Federation member planet has one (apart from the new entries because of their 'novelty' status ... so they'd likely get a smaller starbase like the one seen in DS9 to establish a defense perimeter).
They existed in the 23rd century ... and by the time of the 24th century, I would surmise that SF was able to speed up the construction process considerably regardless of their size and beef them up.
Besides ... the starbases in question wouldn't necessarily have to be increased in size in order to house the Galaxy class for example, because I think they'd only have to enlarge the doors as the internal volume is more than enough to house numerous large ships.
And I really don't see any issues SF constructing those 'mammoths' ... they have 8000 Ly's of space and resources at their disposal, and with the tech in the late 24th century this shouldn't be a problem.
Also ... in addition to what Timo mentioned ... it's entirely possible SF can be using them to establish a foothold in systems that have no suitable planets for colonization ... but the system itself holds importance.
Extension of sensor range might also be true ... and providing vessels in deep space missions a quicker access to a repair/R&R facility.