Why does my brain default to viewing every traumatic/hurtful/painful experience as an opportunity?

In response to the hurt, my body fights back and tries to take control by viewing the pain as an opportunity to gain something from the situation by using the pain as motivation, a route towards gaining a higher level perspective of the world, and a tool for tempering my will.

When the trauma is hard to swallow, I view it as roleplaying helplessness and a lucky albeit highly uncomfortable opportunity for personal growth.

I don't understand it. Why is my brain unable to accept a "loss"? The idea is that one door closed is another zig-zagged door open that allows for greater opportunities due to the unintentional sacrifice.

As a last ditch effort, when the loss "objectively" could have been easily avoidable AND also lead to great losses, the backup plan for my ego is "this is your chance to experience despair and overcome it. In the off-chance you're able to capitalize on technology to live longer, even if it doesn't happen, you've developed your will to the utmost with what you've been given and maximized whatever uncontrollable chances you had to thrive in that situation".

It seems that at the root of it, everything is a win, so long as I do what's within my ability to keep surviving. Not entirely sure though.