I wish I had been less than 30 years into my career when I realized that:
Nobody pays you enough to make a miserable job worthwhile.
Nobody pays you enough to yell at you.
Sometimes it's better to quit and take your chances than to stay miserable.
There's no such thing as "job security".
Your employer doesn't care.