I think it was in a book by Nassim Taleb where I read that at his first day as a trader, he wrote his resignation letter and put it in his desk to have it ready any time.
Ultimately, you want to ensure to always have a BATNA - an alternative to what you are doing now that will make it easier for you to walk away any time (https://www.pon.harvard.edu/daily/batna/translate-your-batna...).
It sounds like you're not particularly happy at work. The right and ideal thing to do would be to talk to you manager and utter your dissatisfaction; demand that the org does better than this, and make it clear that you will walk away if the situation persists. Think of it as a reverse PIP.
Of course, that only works if you have a decent BATNA.