Our dog gets very excited, very easily. He will pace back and forth, making a meowing like noise, whining, and kicks his hind legs backwards as he paces around. I've never seen another dog act this way and I can not find an answer to my question. Everything I read online explains that dogs do this after they urinate, or it is a way of marking territory, but that's not what is happening in this case. He was adopted by us when he was around 1 year old, breed is Papillon, he's done this the entire time we've had him which is about 3.5 years now.
My Aunt's Pomeranian does something very similar to what you describe. My Aunt always called it his happy dance. Occasionally, usually when he's excited from what I've seen, but sometime when just standing there, he'll stretch one leg straight back. I've seen him do it with both, but usually it's the back left.
I only got a vague second hand account of what the vet said, but it boiled down to poor breeding and medical problems. It was something like his hip or knee were locking and he was trying to pop them back into place. He also has issues with a collapsing trachea.
Poms and Papillions are both small dogs and what typically happens is that irresponsible breeders breed the smallest dogs to the smallest dogs to decrease the size and don't breed for genetic health. I would guess that something similar happened with your dog.
I'm not a vet and even if I were one, I wouldn't be able to diagnose it over the internet. It could just be a personality quirk. However, it is something to mention to the vet. I don't think she said there was anything to do, it's just something he has to live with.