Natural limits help. In Too Short A Season, the drug is rare, ridiculously expensive, hard to obtained, controlled by an alien species, and the process is said to be dangerous, too, so it's not a guarantee even when taken as instructed. I wouldn't worry too much about the fictional landscape there.
Some accidents, particularly with the transporter, may not be reliably reproducible, or safe. Even if you figured out what it did, would you still do it if the odds of success were 1 in 100 or worse, meaning death would happen 99+% of the time? We don't know enough about what happened in Rascals to know how reliable that process would be, or if they would have retained their adult memories much longer in a child's brain. Since it's fiction without sound scientific basis, one could contrived any number of reasons why this process wouldn't normally be attempted unless you had no choice.
Second Chances took a rarely occurring atmospheric phenomenon to occur, and Relics only worked by luck. Scotty survived but Franklin got the same treatment and died, IIRC.
It's weird they didn't use various ship transporters to reintegrate those guys in Our Man Bashir. Just because the station's transporters are down wouldn't mean every ship or runabout's transporters were offline, too. But like in Relics, there is only so long such a complex pattern might be maintained, and it degrades relatively quickly.
This is not to say these off the cuff explanations are the best – I'm working from memory – or better ones can't be devised. And it sure doesn't excuse what you're talking about – some solidly dim ideas that should have never been allowed to work just for one story because of the logical ramifications that would have on the fictional landscape. I'm sure there are plenty out there that are worse than those few examples. Khan's blood comes to mind.
But it also doesn't mean if you throw enough money (credits) and technology at a problem, they might not be able to do what you're saying safely. But it would have a natural limit - mostly cost. Unless everybody has infinite resources and access to rare or exotic things, it usually won't become a problem for the fictional landscape.