I know someone who was doing that when I was a student. The guy got a scholarship from the unemployment system (basically was allowed to keep his unemployment benefit while attending university) got his master and became a teacher. So it was possible in the 00’s.
If you’re unemployed talk with your employment advisor.
In modern countries where worker right have more than minimal standard, by getting fired, you get a Severance pay (it’s not what it used to be, but may let you survive a few month) and unemployement benefit (which would give you a fraction of your salary until you find a job)
Quiting means you’ll loose these rights