Vitally, understanding your bad habits is the first step. & I don't even think this is exclusive to just habits. Patterns we have (whether it be job, relationships, etc): Understanding them on a deeper level permits us to understand when we are committing them.
Once you understand your habit, & why you need it (on a fundamentally deeper level), you can start to work around it.