**I edited my post but the timer ran out so I'm posting a new reply... sorry!**
Damaged and flawed and invoked in stupid situations as it is, the idea behind the Prime Directive, I think, is to prevent exactly that; giving technology or knowledge to someone who is not ready for it.
Why it later goes on to mean entire planets can be destroyed because "that's the natural course of history" or whatever bullshit we see in later series, even when they're broadcasting an intra-galactic SOS to anyone in range (!!!!?!!!!) ... that escapes me and I can't begin to rationalise it. It makes no sense whatsoever and is totally dependent on the writer and episode. One week it's ok to give weapons to stone age people to "level the playing field" (TOS episode I can't remember the name of), the next a space-capable and subspace-radio using species (Sarajenka) can't be contacted because it will DESTROY THEM even though their planet is about to blow up.
Or it's ok to assist a government with capturing a fugitive and enemy of the state (Rogar Denar) but not ok to assist a government with capturing a fugitive and enemy of the state (Duras).
Sometimes it's applied well; Voyager's episode with the water planet - the planet is going to eventually fizzle out, the space-faring, warp capable race who live there know, Voyager gives them the specifics, they choose not to because they're like republicans at a global warming convention - but Voyager can't force them to act. It's their choice.
That's a good example of it.
TNG's "First Contact" (not the movie) was another good example.
That makes sense to me.
But then you get retarded shit like Caretaker, Time and Again, the Sarajenka episode and so on. to say nothing of Enterprise's fuck-ups which I don't care to remember so please don't even bring them up.
that's not to say the Federation is necessarily hypocritcal in its overall policy. TNG's Home Soil ("ugly bags of mostly water" episode) had terraforming of a planet halt (and it was policy to do so, the drama being that one of the scientists hid it because of ego / hubris) because of microscopic organisms living there.
Star Trek II had the line "There can't be so much as a microbe or the show's off!" with regard to Genesis being detonated on a planet that may have a DNA strand on it
It seems in some cases, even when it hurts the interests of the Federation itself, at the expense of a bacteria, they wont touch it.
It's very, very confusing.