Well, with the size of the federation, how many shipyards could they have capable of building a heavy cruiser? even if it is only 10 yards, building 1 per year, that is nearly 1000 ships total.
The real problem here is scale. We like to think of each of these ships as lovingly crafted and unique. When the numbers start to get into 3 digits it looks more like they were mass produced carbon copies. Our world bound mindset can't really reconcile the numbers needed compared with what "feels right".
In an organization the size of the Federation, 12 ships is not a production run. It's a design study. if they had said in TNG that there were 300 Galaxy class cruisers, how unique would Enterprise feel?
This also leads back to the question of scope
. In TOS the Enterprise was a heavy cruiser. Not the flagship. We were given the impression that this was just one captain's adventures and that the galaxy was a large place with other captains and crews having adventures that we just hadn't seen. By the movie era things had become myopically focused on "one ship, one crew" above them all. This greatly skews how large starfleet is portrayed in order to have our hero ship be "the only one available".