I did that. After the break, I found a contract that paid more than a double than the previous one. Then another break (this time a little less than a year), and another bump in pay. If you can show you're valuable, the gaps don't matter (at least, that is my experience).
Let alone taking a 2 year break. If you are not having side projects which you work after office hours, late night and weekends.
If you are not learning quickly, adapting or improving your skills fast enough. You are setting yourself up for disaster.