I read a similar/related article a while ago that suggested that your brain develops the equivalent of macros to execute various tasks. Do the same thing often enough in a situation and your brain builds a task to handle it. Those tasks get automatically triggered by the situation/circumstance. More informally, I guess they could be called habits. For example. when driving you do certain actions, like routinely checking your mirrors, or using your turn signals, w/o thinking about it.
Personally, I have one that annoys me. Whenever I sit at my desk I almost always turn on the desk lamp and later turn it off when I get up to leave. Every so often I'll use the desk w/o turning on the lamp, but will then w/o thinking "turn it off" when I get up, actually turning it on - grrrr....
This would explain when you wonder, "wait, did I ..." and then you have to check because you can't remember doing it but you did. Makes me think of this bit by Eddie Izzard (paraphrased):
Squirrels always eat nuts with two hands, always two hands, "arararar," and occasionally they'll pause and look up, as if they're thinking, "Did I leave the gas on? No. I'm, a fucking squirrel!" And go back to eating.