You made the right decision. You were a part in a collapsing system, and a part that wasn’t going bear up under unbearable strains for much longer. You weren’t going to do yourself or anyone else any good by testing yourself to destruction.
What’s terribly unfortunate is that the system really needs compassionate and intelligent people like you, and yet it grinds them up and spits them out — sometimes terminally broken, though not in your case.
Be proud of standing up to the burden for as long as you did, and best wishes on your future career, whatever it is!