All of these occurrences you mention, even with some of your hyperbole, could just as easily happen on a TV show about the modern day military.
Can, and HAVE. Most such shows usually get canceled (or at least viciously mocked) because nobody believes a military organization would let that kind of shit slide.
1) What are you referencing?
Troi
2) Fraternization is forbidden in all branches of the military...
FIFY
3) Resigning. What are you referencing? Starfleet documentation is entirely electronic.
It is not, however, VERBAL. You can't just take off your badge and tell your CO "I quit!" and walk off the ship an hour later (or in Scotty's case, half an hour later). You SURE AS HELL can't verbally tell your C.O. "I unquit!" and have him give you your old job back just for the hell of it.
I mean, obviously you can in Starfleet. Try that bullshit in the U.S. Navy and you'll be swabbing the decks with your eyelashes for a year.
4)If an officer stole a vehicle...you think he would be executed?!
James T. Kirk stole a fucking STARSHIP, violated a direct order from a flag officer, and sabotaged the engines of ANOTHER starship in the process. He's lucky they didn't prosecute him for PIRACY! And yet with all that he did in that entire incident, he comes back to Earth and is facing judgement from a CIVILIAN official for, "Nine violations of
Starfleet regulations." And they DISMISS the charges, just because Kirk's so awesome. Noticeably, the exact same thing happens in TUC, when Starfleet decides to let the Enterprise crew completely off the hook for violating their orders, violating Klingon space, violating the neutral zone, showing up at Khitomer even after being specifically ordered not to, AND for an armed incursion at a diplomatic function in order to arrest several superior officers, all of that on the testimony of a single witness.
There's a REASON military organizations do not take that kind of nonsense lightly. They let Kirk off the hook, then the entire concept of "military discipline" becomes more of a "suggestion" than an expectation.
Which kind of explains this conversation a hundred years later:
REMMICK: Very original, Captain. But how did that child acquire access to a shuttlecraft?
RIKER: Kurland is a highly qualified Enterprise Academy candidate, fully trained in many areas including shuttles.
REMMICK: And did this full training include discipline?
PICARD: Mister Remmick, young men sometimes make rash choices. Which is why Mister Kurland will receive a strong refresher specifically in discipline
Really??? A "strong refresher in discipline?"
You have any idea what would happen if an ROTC candidate stole a helicopter with the intention of running away to a foreign country? I'll give you a hint: it probably wouldn't be a "strong refresher in discipline."
5) If this happened in RL, there would be an investigation.
It happened to Worf.
And there wasn't.
6) Officers referring to each other by first name is quite common, especially in the Navy...
Between officers of the same or similar rank. I challenge you to show me an example of an O3 or an O4 who could get away with referring to an Admiral by first name on the bridge of his own flagship.
7) This happens regularly in militaries...
... where it is considered to be a major problem.
Not so much in Starfleet, where it's just really really funny.
8)This could happen in any TV show or movie about our contemporary military
... usually followed by a long speech by the C.O. about needing to stay focussed on the mission, ones responsibility to your fellow soldiers, and the need not to put your personal matters before duty. OR, if it's a really well-written show, with the C.O. actually helping with the rescue and then reprimanding his subordinate after the fact for letting the situation get that far out of control.
Worf AND Riker both leaving the bridge to save Alexander from a burning aquarium? My
suspension of disbelief may have military discipline, but that storyline does not.
Duras.
Jesus Christ, he wasn't DEMOTED for that shit. Picard basically told him "The Klingons aren't pressing charges, so you're off the hook... but I really
really mad at you." WHAT?!?!
10)Could you imagine a character other than Worf saying this to Picard?
I can, in fact, imagine ANY warrior-race guy saying this to Picard and getting away with it. i can imagine Shran saying it. I can imagine Tomalok or Admiral Jarok saying it. I can even imagine Urdnox Wrex sying it... but then, Urdnot Wrex aint military, and there's a 33% chance of Commander Shepard actually blowing his head off in response.
But that's kin of besides the point: can you imagine Klaus Wennemann saying that to Jürgen Prochnow? (I mean, WITHOUT getting immediately shot in the face?) Can you imagine Denzel Washington saying that to Gene Hackman on the Alabama?
Star Trek just isn't that kind of drama. That is to say, it is not a MILITARY drama, not even stereotypically so.
Why can't Starfleet enter the Demilitarized Zone?
They
can.
DUKAT: Are you telling me that one of the most heavily armed warships in this quadrant is now in the hands of Maquis terrorists? Do you have any idea what kind of response this will provoke from the Central Command?
SISKO: They'll probably want to send ships into the Demilitarised zone to conduct a search. We understand that. But any entry into the zone must be a joint operation between Cardassia and the Federation.
DUKAT: The Central Command will not be interested in any joint operation, Commander. They won't believe your story about transporter duplicates and security failures. They will assume that Starfleet wanted the Maquis to have the Defiant, and they will respond accordingly.
ODO: And what does that mean, exactly?
DUKAT: It means they will seize this opportunity to finally eliminate the Maquis. They'll send a fleet into that zone.
SISKO: Starfleet will cooperate in a search for the Defiant, but they will not allow the Central Command to use this as an excuse for a full-scale invasion.
DUKAT: Of course not. So you will send your own fleet into the zone to protect Federation colonies. But at some point the two fleets will meet, tensions will rise, nerves will fray, and someone will make the tiniest mistake.
SISKO: And we'll have a war on our hands.
So "What's up with that" is that the DMZ is a zone the Cardassians have promised not to place any of their forces in or near, in exchange for Starfleet not doing the same. Which is the WHOLE REASON the Maquis were pissed off about this treaty:
HUDSON: There is no risk, Ben. None. I have been dealing with the Cardassians most of my professional life, and believe me, they are very pleased with what they got from the treaty. They are not about to risk all they've gained by sending forces into the Zone. They're much too slick for that. If I were you, I'd be very concerned with security along the Bajoran border.
Basically: Starfleet told them "keep your military out of the DMZ and we'll let you keep those colonies" and the Cardassians responded with "Yes, of course! We'll gladly keep
our military out of those colonies! Can't say we can keep our
weapons out of there, though... second amendment and all that."
Why does Starfleet have its very own separate, military legal code, and the power to enforce it?
It's actually kind of interesting: from what we've seen, the Federation Government empowers Starfleet to operate as its legal representative in both a diplomatic AND criminal justice capacity. This is why Kirk, of all people, is empowered to pass judgement on Khan and deliver a legally binding sentence, and can open and close proceedings on the prosecution of Harry Mudd. Jean Luc Picard actually has the power to negotiate treaties with people -- as we see him doing in "Encounter at Farpoint" and can represent the Federation in diplomatic first contact situations to the point that his recommendations carry a huge amount of weight.
And this circles back to Kirk's trial in TVH: why is the PRESIDENT OF THE FEDERATION reading Kirk's charges before the entire council? Primarily it's because of the seriousness of the charges, but mostly it's because Starfleet REPRESENTS the Council in a very real sense, and therefore answers directly to it.
So in answer to your question:
How can a non military entity govern itself with military law?
By being the legal representative of the legislature that controls it and equivalent, in a way, to an
entire branch of the Federation government. Or at least, empowered to act like one.
Starfleet gets in multitudes more live engagements with hostile counterparts than ANY modern day Navy could hope for. Or rather, not hope for, as A live engagement with another nations military is something that should NEVER happen. It could have serious consequences.
And it yet those engagements DON'T have serious consequences in Star Trek...
You never wondered why that was?