The Prime Directive pretty much is two different things as it's applied rather liberally to any number of situations. One, it prohibits interference in the development of a pre-warp society. Though this doesn't include spying at all. Two, it prohibits interferences in the internal affairs of any society. Even if they're your biggest ally asking for help in a civil war that was instigated and supported by your biggest rival.
Personally I think the PD is rather... stupid... at times. It's okay to let an entire people die when you can save them..... why? Because you don't know the consequences as Janeway said in Time and Again? Because there's a "cosmic plan" as Riker said in Pen Pals? Even Picard just says there are "ramifications" of the Prime Directive that dictate some lives cannot be saved in Homeward. Again.. why?
Picard asks if a geological incident should make an exception, then a disease, then a war. When people hesitate about the war, then Picard just acts like he won a point. As if it's an all or none kind of deal. I don't get that. Janeway's you don't know the consequences? Come on... that's like saying if someone's beating a pregnant woman to death you should just keep walking because that kid might grow up to be Hitler. Comic plan? Circular argument. If there's a cosmic plan I'm part of it and interfering to save lives seems more moral than letting helpless people die because it might be inconvenient. Ramifications? These are all self-imposed.
I never got upset when any captain broke the PD because... it's contradictory at times and morally bankrupt in others. Everyone acted like Worf's brother did something terribly evil by saving those alien sheep herders in Homeward. Heck Paris said it best "They're all going to die... anything's got to be better than that." Which Janeway just ordered him to shut up having lost that argument.
Not interfering with internal affairs of other cultures. That even somehow applied to the Cardassian occupation of Bajor. Which makes no sense to me at all being the Federation was fighting a war with the Cardassians at the times. The first thing you do in any war, is give weapons to the partisans fighting against the other side.
The PD is well intentioned, don't get me wrong. It's there to protect other cultures from exploitation and us from getting drug into matters that don't concern us. But in reality... you have to take things on a case by case basis. It can't be all or none, like the letter of the law says.