Hi S.,
Good luck, My son started this, and it takes a lot of patience, and wherewithal, NOT to respond to it. The problem is: someone responded to it in the first place - and he thought it was funny - the reaction he got from scratching.
I have to face him away from me, and usually have a hard time extricating him from my hair.
We have been going through a mantra of 'gentle touch(es)'. It sometimes helps - he'll release his grip on my hair and just run his fingers through it. (granted they get tangled, but it is different from grabbing fistfuls and yanking!)
I find that my son is a) tired, and b) bored when he does this. Distracting him with a toy sometimes works - when it doesn't usually means he's tired enough for bed or a nap.
Picking him up more often (I usually let him run free in his zone(s) in the house) seems to help a fair bit. Pointing out different things in the house and naming them also helps.
One thing I have found that is rather fun(ny) and rather breathtaking at the same time is that he LOVES MY DUSTER. An old-fashioned feather duster. We have dusted my house more times in the past 6 months than I have ever dusted in my life.
No, it doesn't spread the dust around, it attracts it like a magnet, and you shake the dust off outdoors.
The stern(ness) isn't what is going to get him to redirect - he doesn't quite 'get' the emotion/need behind it.
When he is by himself, and calm and maybe fresh from a nap, try giving him a demonstration (maybe with husband, cat, dog, grandma/pa) of gentle touches, complete with a lot of verbage directly related to gentle, patience, etc.
Good luck!
M.