And what TNG story did that happen?
First of all, we must necessarily assume that the events which occur aboard the starship Enterprise are not unique, or even extremely uncommon. There are thousands of starships in Starfleet, zipping around all over the place. It is simply not believable that the Enterprise is the only one which keeps running into things like planets inhabited by pre-warp societies which are about to be extinguished by a natural disaster. So I'm going to assume that we agree to the premise that Starfleet vessels have encountered, at the least, hundreds of such worlds.
So moving on. In "Pen Pals," the Enterprise encounters the world Drema IV, inhabited by the Dremans. The Dremans appear to be roughly as advanced as mid-20th-century humans were, in terms of technology. If we assume similar advancements in health care, agriculture, etc., we can reasonably assume that there are, at minimum, hundreds of millions of Dremans, and probably more like billions. But according to Picard's interpretation of the Prime Directive,
every single one of them must die. It is only after Data inadvertently violates the Prime Directive, and then makes an emotion-based plea to the rest of the crew to recognize Sarjenka's radio signal as a form of requesting aid, that the crew decides to violate the Prime Directive and save the Dremans. As if to drive home the point that Starfleet is institutionally opposed to such measures, this will later be implicitly brought up as a black mark on Picard's record by an activist judge in "The Drumhead" when she mentions that he has violated the Prime Directive nine times since taking command of the Enterprise.
A few years later, in "Homeward," the Enterprise again encounters a pre-warp civilization on Boraal II. This civilization is doomed to die due to the dissipation of its atmosphere. Crucially, it is fairly clear that Starfleet has known about this impending disaster for quite some time, which makes sense, because there is a Federation scientist observing the Boraalans. It beggars belief to surmise that Nikolai--who is passionately dedicated to the cause of preserving the Boraalan people--would not have reported their plight back to the Federation. So Starfleet is clearly making a choice
not to save the Boraalans, either by artificially preserving their atmosphere or by relocating them. It appears that this has not even been given meaningful consideration at any level. And all of this is confirmed explicitly when Picard flatly refuses to help the Boraalans. The Boraalans are much less advanced than the Dremans, but we should still conservatively estimate several hundred million people are living on this planet. Nearly every single one is condemned to death by Starfleet's inaction.
In the same timeframe as TNG, we have the VOY episode "Thirty Days." Here, Voyager encounters the Moneans' ocean world (one of many truly interesting concepts tragically wasted on a show that refused to be interesting.) The ocean world was in danger of dissipating, and Voyager's crew discovered that this dissipation was caused by the Moneans themselves, and that it could be avoided if they would shift their economy to a more sustainable one. (One wonders if the people who complain that "Star Trek has gone woke because of the Kurtz Man" ever watched this episode, which came out in 1998.) But the Moneans refused to commit to such changes, even though Voyager determined that their world would dissipate completely within
five years. Not only did Voyager choose not to assist the elements within Monean society which wanted to change their economy, Captain Janeway severely punished the one member of her crew who tried to help, and was willing to
kill him to stop him. This world had
five years to live. If the Monean government couldn't be bothered to shift its economy, do we really think they would have taken the necessary steps to evacuate the planet and colonize a new one? The Moneans are dead now. That is the only possible way to read that episode.
Now multiply those three instances (just the ones I could think of offhand) by the thousands of starships in the fleet, and try to imagine how many billions of people are dead because Starfleet didn't act. Now maybe you think that's really great and awesome, but I much prefer the Jim Kirk/Beckett Mariner approach to the Prime Directive, which involves
saving the lives of people who are about to die. Not going back in time and saving Edith Keeler, just saving a world full of people who are about to die because of a preventable catastrophe.