My husband does this, mostly in the winter, and it drives me crazy!! There are 2 aspects to it. He is definitely congested most of the time, and says he must do it to clear phlegm from his throat. I can hear his congestion, even when he breathes. However, he also admits that part of it is pure nervous habit! And like your son, my husband can manage to not cough at all when he's entertained or distracted, or during a 2 hour play or symphony.
I doubt seriously your son is doing it for attention. I would consider having him checked by an Ear, Nose and Throat doc. My daughter suffered from constant congestion and an ENT discovered that her tonsils and adenoids were huge. They were taken out, and it's like night and day. My husband also uses a netti pot (google it if you don't know'), and it helps, but getting your son to use one might be challenging!
Beyond that, I would try some good old-fashioned positive reinforcement. "I noticed you haven't coughed at all during breakfast--that's great!" Works for my husband also. : )
Good luck. I feel your pain!