What you are seeing above is an example of a stereotypy behaviour as suffered by one of my rescue dogs, Beanie the 10 year old Yorkshire Terrier. Stereotypy behaviours are repetitive actions exhibited by dogs that at first may appear quirky, or even funny, but in actuality they can be a genuine cause for concern and sure sign of psychological distress.
Stereotype behaviours can be due to chemical imbalances in the brain, but are usually picked up by dogs who are not getting enough mental stimulation for their needs and/or cannot satisfy behavioural needs that are instinctive to them as dogs. These behaviours are compulsive and can be self-mutilating. When reinforced and rehearsed over a long period of time they can become extremely difficult to get rid of.
In Beanies case, she came home to us in a physically neglected state; her legs had even suffered muscle atrophy from not getting any exercise. She had been fed a very poor diet and as a result had to have all but 4 rotten teeth removed. Behaviourally she was very shut down and lost within herself. All in all she was a very endearing, but troubled dog.
Her compulsive licking behaviour as seen in the video, gives us a small insight into her past. Licking doors and walls was probably her coping mechanism/self soothing/enrichment activity in order to cope with boredom and neglect. After observing her behaviour for a while I realised she was finding it extremely stressful being behind closed doors and didn't know how to deal with excitement/stress. Identifying her current triggers (eg overstimulation) was the key to helping her feel better.
Over time we have been able to introduce into Beanies life some healthy and instinctive enrichment activities such as chewing, scent games, playing and leisurely strolls/scent tracking around different places. She has been with us just a few months and already is learning to redirect herself away from these ingrained behaviours and engage in something more desirable. She is also a physically much healthier dog; aged 10, going on 3!