I’ve noticed there’s a similar challenge in keeping bad ideas out of your head.
This has been discussed from time immemorial and confronting it as it is (that in the case of habits we are more animal than rational) is the beginning of change.
An example is that you can't just "cut it out" you have to replace it with something else.