In my head canon, the Galaxies were just far too time- and resource-intensive to build. They were products of an era in Starfleet when they could focus on more exploratory-centric mission profiles, becoming arguably complacent in their peacetime "utopia".
Then the Borg. Then the Dominion.
Starfleet needed to push out smaller, more agile and combat-oriented ships and refit other existing vessels quickly. The Galaxy platform simply didn't do itself any favors in those areas. So the Sovereign and her FC "classmates" were born - smaller and more powerful. The larger E-F was built after the Dominion War ended and after Janeway ostensibly defeated the Borg in "Endgame". Conflict in the A&B Q's subsided and things got back to relative normalcy, and they once again embarked on a more exploratory footing. Based on Doug Drexler's description of the immense E-J, this was also the result of a renewed push in the future for intergalactic exploration and colonization (hence the name "Universe-class").
in fine, ship size is really nothing more than a reflection of the times in which the Federation finds itself, resulting in a change of focus of the kinds of missions they choose to deploy their vessels. If war comes along again, they go smaller again. Rinse and repeat.