In short:
If a writer cares about the plausibility of a story, they will try not to put their characters in situations guaranteed to drive anyone insane. Those careful writers will either plan on ruining the mental health of their characters, or else try to limit their character's experiences to those which have a real probability, however small, of their characters retaining their mental health.
However, there are many examples of writers and others involved in the creation of various fictional works who put their characters through one dangerous or harrowing experience after another, without thinking about the cumulative psychological damage a normal person would suffer from those experiences. And some of those writers have been financially successful.
Long answer:
Some fictions put protagonists though events which could drive someone insane, and do so repeatedly. And the writers aparently give little thought to how that would affect the psychology of the the characters.
I am thinking of adventure tv shows in particular. If successful, they have tens or hundreds of separate episodes where the protagonists have exciting and dangerous adventures. And if you try calculating the odds that the protagonists will survive every single adventure in a long lasting tv adventure series you will find the odds are very small.
Suppose that the protagonist has a 90 percent chance of surviving the average episode. If so, the odds that he will survive two episodes are 0.9 times 0.9, or 0.81, and the odds he will survive three episodes will by 0.9 times 0.9 times 0.9, or 0.729, and so on.
The odds of surviving the dangers in 10 episodes would be 0.3486783. The survival odds in 20 episodes would be 0.12157. The survival odds in 30 episodes would be 0.04239. The survival odds in 40 episodes would be 0.01478. The survival odds in 50 episodes would be 0.005153 - half a percent. The survival odds in 60 episodes would be.0.00179 The survival odds in 70 episodes would be 0.0006265 - a little more than 6 chances in a thousand.
If the episodes are dangerous enough to be exciting, the survival odds for the protagonists will become insignicent after a few dozen episodes.
So I developed a theory that in an episodic fictional tv series, each episode will happen in an alternate universe of its own, separate from those of other episodes -with the exception of episodes which are sequels to previous episodes, of course. Thus the protagonist will only have one - or a few in the cases of episodes which are sequels - exciting and dangerous adventures in each alternate universe, and will have much better chances of survival.
And of course if someone gets in deadly danger only once in each alternate universe, instead of tens or hundreds of times in the same timeline, they will be much less likely to break down from Post Traumatic Stress Disorder (PTSD) than if they experienced all those narrow escapes from death one after the other.
I note that most persons who suffer from PTSD have not had tens or hundreds of exciting and dangerous adventures one after the other. Of course fans might speculate that various fictional adventurers are actually not sane but suffer from various psychological disorders, such as believing after surviving so many dangers that they are invincible and nothing will ever harm them.
So I like to imagine that the episodes in long running adventure shows happen in alternate universes separate from those of the other episodes, to give the protagonists better chances of surviving and of retaining their mental health.
So the modern trend to have serialized television shows, even adventure shows, is hightly unrealistic in so far as some of the protagonists remain alive and mentally healthy at the end of the series.
I point out that in Lost In Space (1965-68) danger was faced in almost every episode, sometimes by all of the characters and sometimes by just some of them. The character of Will Robinson probably had the most adventures, and he was portrayed by Bill Mumy (born Feb. 1, 1954), who was 11 when the series begain and 14 when it ended. So it would be hard to suppose that the episodes happened over a much longer timespan since Bill Mumy and thus Will Robinson only aged a few years during the series.
So Will Robinson is an example of a fictional child facing death, separation from their family, or other dire fates, at least 50 times in the 83 episodes over about three or four years of fictional time, and not obviously suffering from PTSD. Unless most of the episodes happened in alternate universes from the other episodes.
There is an even worse example in The Adventures of Rin Tin Tin, which had 164 episodes from 1954-59. One of the protagonists was Rusty, portrayed by Lee Aaker (September 25, 1943-April 1, 2021), and Rusty got into danger in most of the episodes, and yet remained alive and in apparent good mental health thoughout the series.
So appaently a lot of television producers and writers have been successful despite ignoring the cumulative pyschological traumas that their protagonists should have suffered as a result of their experiences.