...Indeed, in many such roles, it wouldn't matter whether a ship was modern or ancient, as the "threat environment" would not have evolved a bit in the past three centuries - so it might make sense for Starfleet never to mothball its starships, but rather run them to the ground in tasks where old-timers performed just as well as shiny newbuilds.
Yet we know Starfleet does idle some of its vessels, as per "Unification". But we don't know if those vessels are actually useful, or mere worn-down hulks incapable of serving in any role other than weird Romulan decoy.
Well, its entirely conceivable that SF had a long time of relative peace going on between the mid 23rd and mid 24th centuries... which explains presence of older ships in widespread use (and also, SF has an affinity for upgrading older vessels to perform like new ones in combat situations because they would likely have an R&D division that essentially cater to that particular area).
It wasn't until TNG era that SF decided to start churn out much more of new ship classes.
Probably also because their level of technology advanced to the point where they saw it as a time to upgrade/produce (attracting the attention off the Q and Travellers in the process).
In war time, ship production would likely jump through the roof.
As for how bit SF actually is in men and ships...
We don't know exactly.
SF ships have really good scanning capabilities and seem to assign 1 ship at a time to a specific task (in case of our heroes, it often meant preventing a full scale war or something else - in case of DS9 though, it was a bit different).
Majority of SF ships would probably be out exploring and would trade places with other classes of ships inside Federation territory for duties like supply, relief efforts, diplomatic functions, etc.
But it wouldn't surprise me if SF has at least somewhere around to 10 000 ships in peace time... if not more.
If the registry numbers mean anything (and I think they actually might refer to production numbers), then the Feds had constructed 74656 ships by the time Voyager was released into service (that was before the FX department started randomizing the numbers into oblivion - or not).
Either way, I see it as conceivable that as they advanced technologically, building ships became easier/faster (despite how 'complex' a ship may be - that would only play a part during the drawing board stage while actual construction time would likely be incredibly small).
So it's not unlikely that the Federation could have close to 35 000 ships in the mid/late 24th century (while the other 37 000 were the ones constructed and destroyed/retired before that time frame).
I mean... we do have to take into account the premise of technological advancement and expansion of the Federation.
I doubt that SOL system is the only one in the entire Federation producing ships (other Federation members would likely allocate a portion of their shipyards to SF production because it IS an organization in charge of safety among other things).