I'm not Barney, obviously, but yes, that's my understanding of the reasoning. It has applied to my life, for sure. Realizing the compulsive nature of these behaviors--that they are an effort to have the story turn out differently--can go a long way toward helping to deal with them.
Trouble is, of course, sometimes it's hard to tell the difference between what it is that we truly "want" to do, and what we are tempted to do even against our better judgment, even when it results in negative and counterproductive outcomes. Humans also have a very highly developed ability for rationalization!
I'm just a poor wayfaring stranger, a million miles away from home.