This is called "learned helplessness." I read an article on this where a dog would encounter electric shocks and it got to the point where the dog wouldn't even try to jump or leave the area with the electric shocks because it just assumed that the electric shocks were going to keep happening.
Whenever you think to yourself "why bother changing, it's just going to be as bad as it is here" that is learned helplessness, and you correct that the way you did, by leaving the situation. It's a coping mechanism for people that doesn't have the physical, mental or emotional energy to endure a change to get themselves out of a bad situation and it's a trap.
Congrats on working your way out of the bad situation and hopefully this empowerment continues with your for the rest of your life!