Everyone does it sometimes. Some do it regularly – shoot themselves in the foot or put obstacles in their own chosen path. Behavior is self-sabotaging when in attempting to solve or cope with a problem, it instigates new problems, interferes with long-term goals, and unsettles relationships.
People don’t always realize they are sabotaging themselves. This is in part because the consequences of many actions are not immediate, which makes it hard to connect behavior X to bad outcome Y.
One way to know whether a behavior is self-defeating is to examine it in the context of your long-term goals or desires and determine whether it is consistent with them.
Connecting a behavior to problematic consequences does not guarantee the ability to disengage from the behavior. Sometimes, people undermine themselves because the behavior feels right. With basic survival functions, behavior based on what feels right is fine: feel hungry, eat; feel thirsty, drink; but emotions are different. Often times, self-sabotaging behaviors feel right because they help us escape intense and uncomfortable emotions that would be better off dealt with openly, directly, and when appropriate, with professional care.