Those three ship classes were the most versatile designs ever built. They were easily upgradable as new technologies came online. Other ships were more powerful or had better qualities, but they were either fragile or they were not flexible enough to accommodate multiple upgrades over the long term.
Kirk's Enterprise was around for years before Kirk took command over it (at least 10 years, and who knows if there was a Captain before Pike), and it was well into service (tough refitted) at the time Kirk was an old Admiral. Seems starships in this era simply did have a longer life-span. For the follow-up ship (the Excelsior class) it makes sense to be this long in service as well. Maybe they just built way more ships of that class, so much more were still in service 80+ years later.
The Oberth-class was a scientific vessel. It had shields only suitable to defend against natural phenomena (ion storms, nebula, ....), and wasn't in any way tactical useful. It's purely a vessel to transport people from one place in space to another to conduct experiments. That shit is durable. Like todays ferries that are 50+ years old and still in service, the Oberth class being around for that long is logical.
The only problem is the Miranda class. She looks like a contemporary of the Enterprise, and is actually even inferiour to her. Her being around this long makes no sense, the only reason is that they had a detailed CGI-model of her around, and used that to fill in their fleet shots with more variety. In my headcannon "it's simply another ship", like when they used the BoP to stand in for a big & new klingon starship on TNG, or when the D7 appeared once on ENT. They were all supposed to be different starships.
On a related note: In my headcanon, half the background ships in the large Dominion war scenes are actually smaller scaled vessel, not bigger than the Nova class. Doesn't make much sense to have a fleet of thousands of "capital ships only", and no small/medium sized ships.
The Enterprise refit in TMP was the result of a strategic arms treaty with the Klingons and/or Romulans that stipulated fleet size limits. The Enterprise refit was not "technically" an addition to the fleet size. This limitation was dissolved as part of the Khitomer Accords.
I like that idea. Other than that, I never really cared for the technical details of the refit. "It's a refit. It looks different" is really all I need in terms of explanation for the different look.
The Federation entered a pacifist mode in the early to mid 24th century. This mindset was a transition of thought and attitude. One example of the change was the reclassification /propaganda / philosophy that Starfleet was no longer viewed as a military organization despite all evidence to the contrary. This philosophy was abandoned during the Dominion War.
IMO Starfleet is some sort of "coastguard" type. So them not really being "the" military, but at the same time being used to defend the borders are true at the same time. They are essentially the organization "all things starship related". In my headcanon there is also a "true" military (the MACOs, and the various planetary [surface, air, water, deep sea] forces), but Starfleet is the primary organization using starships.
The declaration "not the military" comes from Starfleet being a descendand of something like NASA/ESA who picked up on defending Earth against asteroids, space phenomena and whale probes (and later with weapons against aliens, because of their experience), and not coming from something like Trumps "space force" that also does a little science on the side now...
The moneyless Federation is really just a lack of hard currency. By the 23rd century Federation currency was a form of Bitcoin. I'm willing to compromise and claim that humans in the 24th century do not use money. But only humans or human colonies, or Earth/Sol system. The Federation as a whole still uses a monetary economy.
Oh, the Federation DEFINITELY is active in trade! That's not even head-canon, that's canon. It's just that the society is a post-scarcity society for it's citizens. Everybody can have basically whatever he wants (food and clothing for lifetime, houses, vehicles, holidays....) that money becomes meaningless. I guess there's more something akin to a exchange market, where people can trade goods (like a house at the sea) that are scarce with other scarcities they currently don't need (like historical paintings, or a luxury boat), but without anything really having a "prize" tag. Basically like the super-rich today, just for everyone.
The value of currency that IS used in trading in the Federation is just SO BIG, it's completely seperated from the individuals - no human needs the wealth to buy an entire Galaxy-class starship for it's own, or vaccines and food for a whole population.