Yes it has. It tries to stay as close as possible. Gene made an effort to do so by consulting scientists at the time.
I mean, yes and no.
Star Trek does generally try to adhere to a consistent set of rules, but really important technologies in ST violate the laws of physics. Obviously faster-than-light technology comes to mind, though warp drive is a necessary artistic conceit for a show about interstellar travel. But transporters are
not a necessary conceit, merely a convenient one for the show's budget -- and they utterly defy the laws of physics as we understand them (hence the need for a "Heisenberg Compensator"). "Inertia dampeners" also come to mind, and so does artificial gravity. And then in later seasons, the use of various "-itons" of radiation became virtually like waving a magic wand.
Why? The maquis may be debated, but surely every one would love Starfleet for their defense of the Federation in the Dominion War? They managed to attack Earth a couple times and conquered Betazed briefly, after all.
Not necessarily. There's almost always an anti-war war movement; even World War II had its domestic opponents who were not themselves fascist sympathizers. Check out
A People's History of the United States for examples of anti-fascists who still opposed World War II; they felt it was a war of colonial powers against colonial powers, with colonized peoples caught in the crossfire. (They were not entirely wrong, but I disagree with their opposition to the war effort.)
I can easily imagine a decent-sized movement of Federation citizens actually
blaming Starfleet for the Dominion War. I wouldn't
agree with such an argument, but it's not implausible to imagine that someone might look at Starfleet being ordered to stay out of the Gamma Quadrant by the Dominion and replying with, "You can't stop us from exploring the GQ!" and constantly crossing the wormhole for the next three years, and look at the way the first officer of a Starfleet starbase was helping Gul Dukat fight the Klingons from his captured bird-of-prey before he went and helped the Dominion take over Cardassia, and might conclude that Starfleet was inadvertently responsible for the Dominion feeling threatened enough to invade the Alpha Quadrant and for Gul Dukat being in position to take over Cardassia. And there are generally probably some out there who feel that coming to a diplomatic solution is better than war (even if that solution is one the Federation government would reject as a pretext for further war), and even some out there who would feel that accepting Dominion occupation would be preferable to war.
Add to this that there are probably people out there that generally oppose the Federation's constant expansion as a form of neo-colonialism or cultural imperialism, and that there are others who generally hate Starfleet for not backing up the Federation colonists in the DMZ when the Cardassian Central Command kept arming Cardassian civilian militias and for targeting the Maquis instead of just staying out of the fighting. Hell, even David Marcus generally hated Starfleet as a warmongering force in
The Wrath of Khan.
Again, not necessarily what I would agree with. But I can plausibly see it. People almost never have unanimity in their political beliefs.
Edited to add:
There
is something kind of disturbing about a free society where service in the military is considered
the best possible career someone could have.