You can develop a habit over the course of a few weeks or even a few days. By doing the same thing and not being aware of it, your brain starts to think that this is a normal and ok thing to do. So you do it. The more you do it, the more “ok” it will be in your mind. For example, picking you nose. A disgusting habit of a lot of younger kids and some older people as well even. They do it, and start to think it’s ok. Even if they know it’s bad after it being created a habit, they can still catch themselves off guard and actually end up doing it anyways. I myself thankfully don’t suffer from this, but I still do have my bad habits as well. To get rid of this, you can ask for others help in keeping you accountable or constantly keep yourself on guard; knowing what you’re doing. Friends and family are also a great way of getting help. Instead, you can do something else as a substitute.
Hope this helped!