I would turn this round. Your habitual behaviour comes to be associated with your environment. By removing yourself from that environment you find that those habits become weaker and may vanish. Behaviour isn't changed so much as behavioural cues can be eliminated.
By changing your environment you can dramatically change your behavior to the point where it can literally kick a heroin habit.