Perhaps I wasn't clear in the original post.
If you are facing bullying, racism or sexism (or indeed any other -ism), then yes, leave immediately.
But for most of us, it's not outright bullying, but the constant grinding down, the non-stop requests for overtime, the occasional "helpful comments" that are actually insults, the constant interference, that really gets us down. Individually, they might mean nothing, but over time, they build up, and make you feel as small as the full stop at the end of this sentence. That's when you must plan to leave, but by first upgrading your skills.