Basically, my student now indents just like any other programmer (to the extent that anybody should care about it) but knows why he does so, the concrete benefit he derives from it. He is open to changing his habits in the face of changing circumstances, and not to dwell overly on minor local details compared to the prize: understanding what this program does.
Once I happened upon this happy result — learning useful skills without harmful metaheuristics — I noticed that the same arc has been playing out in parallel along several other frontlines. My student used to use single-letter variable names, and now he’s starting to use words in some situations. He’s starting to add comments. He went from having no comments, to commenting every line (including, yes, “increment x”), to noticing that that wasn’t useful. Ok, he might take a few decades to figure out that one. I’m looking forward to seeing the same dynamic evolve in where he draws his function boundaries.