I asked same question about my (now almost 8mo) DS like a month ago... he was shaking his head like that too and I was freaking out!!! Almost everyone that posted a response, and that I've talked to IRL since, said that many babes do this when they pee and that it is totally normal

It has something to do with the sensation/ very slight, momentary drop in body temp when the urine leaves the body.