Maybe due to many inhability to engage in healthy relationships with other people, either romantic or other, many find confort having over afectuous bonds with animals. And sometimes give up on bonding with people.
By looking at that picture, Harley got caught in that behaviour.
Still, i do not believe he is having sex with the dog, that is preposterous.