Can habits be implemented by playing mental scenarios or playing things in your head?
The answer is yes and can be supported by a theory called implementation intention.


  An implementation intention is a self-regulatory strategy in the
  form of an "if-then plan" that can lead to better goal attainment, as
  well as help in habit and behavior modification. It is subordinate to
  goal intentions as it specifies the when, where and how portions of
  goal-directed behavior. The concept of implementation intentions was
  introduced in 1999 by psychologist Peter Gollwitzer. Studies
  conducted in 1997 and earlier showed that the use of implementation
  intentions can result in a higher probability of successful goal
  attainment, by predetermining a specific and desired goal-directed
  behavior in response to a particular future event or cue.