For some people, work is about money and jobs are interchangeable. They may still have self identity associated with being rich, or being self-sufficient etc. That can take a hit if they lose their wealth or self-sufficiency...but it is less likely (though certainly not impossible) that they will feel the loss acutely and have it affect their mental state in a longer term way.
Other people identify very strongly with their career. They don't teach...they are a teacher.
Just like I don't do science, I am a scientist.
If I had to stop doing science, I don't know if my identity as a scientist would persist, or if I would suddenly become a 'failed scientist'. It would be reasonably common for the latter response to lead to depression and other mental illness.
I think the important thing to note is that 'role loss' is a real concept within the literature on mental health, and an accepted cause of depression.
One strategy for avoiding this, is obviously to diversify your self-identity. If all your self-esteem is locked up in one element, then losing that element could be devastating. This is why so many elite athletes struggle after they retire. Some of them have had nothing else in their lives since they were children. It is also why I worry about the people on MN who say 'I am a mother, and my children are all that matter to me'. It is why 'empty nest' syndrome is a real problem.
From where the OP is, having lost an identity, or having had it poisoned and turned into a negative, the way forward is to properly examine what else you are. You undoubtedly DO have other roles and identities, so focus a little more on those, until you find a new goal or identity emerging from the ashes so to speak.
Keep correcting any negative mental commentary. You can still be a teacher even if you aren't a professional any more. You still were a teacher, even if it fell apart at the end. You still have all the triumphs and all the differences you made in peoples lives as a teacher. They aren't wiped out by you stopping the job. They are real and continue to change the world. Stopping doesn't negate having done it in the first place if you see what I mean...