The non-ship oddities, things too interesting or too dangerous for various reasons, to go out for immediate civilian use ends up at SFHQ. Paperwork from bygone eras did not get any more efficient when automated, just more quickly put into stasis when things can't be determined easily. Other ships get consigned to the orbit for other reasons, having little to do with battle damage, the cost of repair or even if the ship can be upgraded and repaired, and far more to do with lost bureaucratic messages.
The oldest ships generally slip unnoticed below the orbit of Io, becoming the 'Yellow Fleet' and at some point atmospheric drag slows the ship and Jupiter claims it. Few efforts are made to 'salvage' such vessels that end up in Jovian orbit as the work to dismantle and reforge components and remove older metallic mixes isn't worth the time or effort to do. SFC determines which of the old ships are Museum quality and which end up in Jupiter's orbit. Decommissioned ships first go to SFHQ for systems removal and powering down of non-essential systems, and then get a skeleton crew to take the ship to SFC for final disposition. First of its kind production for NX class ships winds up at any of the Sol System based dry docks or at the orbital base. That said, while new technology incorporated into ships is first tested, with much fanfare, at Earth, the basic design and engineering work to get to a new ship design starts at SFHQ. It is the division between Politics and Logistics. The very upper echelons of StarFleet that interacts with the Federation Council is in San Francisco, while the nuts and bolts of day-to-day operations is at the SFHQ base. One is in the Sol system, the other is not. SFHQ is the central command point for Fleet disposition, logistics, and sector coverage, ensuring that all bases, posts and ships, along with Federation outposts manned by StarFleet are supplied and have regularized personnel tracking. SFC is central to the Sol System dry docks, repair/refit systems, and also the place of such things as the Historical Museum located in Mars orbit and the 'Ship Graveyard' at Jupiter. SFC is the main ship construction and repair facility, with multiple base sections for that purpose along with the central and organized structure for Fleet Command. It is often, erroneously, referred to as StarFleet Headquarters (SFHQ), which is the central fleet command base in the Alpha Quadrant. StarFleet Command (SFC) is the term generally used to refer to the main Fleet Base in San Francisco, Earth, as it is the main training and centralized command structure for the entire fleet.