Beating yourself up is a step in the right direction 

Knowing that there are things that you want to change about your own behavior is the first step toward affecting change.
Beating yourself up about undesirable things is a good first step. 

So contrary to the cliche, you should beat yourself up.

Long enough to do something about it. 

And eventually long enough to learn to identify undesirable behavior without needing to beat yourself up.