The reason why some dogs try to mate with your leg is because of sexual frustration. It has come about because from the dog’s perspective they regard the human family as their pack but they can’t mate with humans. Through domestication they have become celibate. It is tough for them.
Sometimes the desire to mate spills over into hopelessly non-productive mating activity such as humping their owner’s leg. You can’t blame them and should never punish them for it. The person should politely reject the advance.
The human’s lifestyle is quite suited to the dog which is why domestication works so well. They are both pack animal species. As Dr Morris (Illustrated Dogwatching) says: “The members of their human family serve well enough as an adopted pack…Dog society and human society make a good match.”
The trouble is that there is a breakdown when it comes to sexual activity. Humans don’t have the dog fragrances which provoke a desire to mate. Therefore humans don’t trigger the need to have sex. But sexual frustration builds up.
It builds to the point where the family dog will mate with anything including the family cat if they are part of the dog’s family and inanimate objects such as cushions.
Because of the human’s size and shape their leg is the only piece of anatomy which is available and anywhere near appropriate.
But sadly for the dog humans are members of their pack that are never in a condition to be mated with.
Dr Morris describes domestic dogs as ‘mental hybrids’. This means that they are ‘powerfully attached to both species’ i.e. dogs and humans.
This occurs during the critical process of socialisation in the 4-12 weeks of their infancy. It is vital for their domestication but it leaves them without a mate with whom they can procreate.