You've described a type of obsessive-compulsive disorder (OCD) in Barnum - mood/behavioral disorders characterized by repetitive, invariant, patterned behaviors that are exaggerated in intensity, frequency, and duration given the inciting stimuli (i.e., expressed out of context). The behavior interferes with health and well-being. Earlier in the course you may have been able to stop the behavior, but that may not be the case at this time. He may hide (to perform the behavior), become aggressive when you attempt to stop it, or may begin avoiding you.
His "stargazing" may also suggest partial seizures or dysphoria (a state of unease) and so consultation with a specialist veterinary neurologist (please see here: www.acvim.org) should be considered. Was anything untoward noted on his pre-anesthetic blood panel prior to his dental cleaning?
All cases of OCD warrant intervention which is individualized and based on frequency and severity of clinical signs. Treatment is usually a combination of behavioral and environmental modification and psychotropic medication. The goal is to minimize and if possible eliminate bouts of compulsive behavior and the concomitant anxious states that accompany them.
In general, for OCD we need to identify and eliminate trigger events/situations. No punishment should ever be used since it can heighten anxiety and worsen the problem. If possible, these pets can be redirected to an alternative and incompatible behavior such as licking food from a toy instead of licking the skin if the redirection doesn't make the pet more anxious. Pets should be calmly rewarded for any spontaneous calm behavior. Keeping a structured daily routine helps decrease anxiety. The most successful medications used in the treatment of OCD in people include SSRIs such as fluoxetine (Prozac) and clomipramine (Clomicalm). Typically, psychotropic therapy is necessary for longer periods of time than other anxiety-based disorders (months to years depending upon severity and how long the disorder has been ongoing). Lifelong medication use isn't unusual in severe cases.
Please respond with further questions or concerns if you wish. I regret that my state board of veterinary examiners doesn't allow me to speak to customers by phone in this venue but other experts in this category may be able to assist you in this regard. Please let me know if you'd like another expert to do so and I'll opt out of this conversation. Please stay in the conversation if you wish.