Mounting is Sex? Wrong!!
The biggest misunderstanding here is that dogs mounting and humping each other are "having sex". Dogs hump each other as a dominance gesture: males hump other males, females hump subordinate males, and females, etc. , and neutering or spaying does not interfere with this behavior. It's a social signal of dominance or even insecurity:
Anybody who has been at a dog park has seen this behavior. Sometimes mounting ends a fight: my dog Lola got mounted by a female Dobbie once and that put her in her place right away: Lola stopped harassing her and they were very polite to each other after that. Sometimes fights start because dogs of equal rank do not accept the other dog dominant behavior.
But it's not about sex; there is no penetration, nothing of the sort, it's just mounting.
A neutered male dog can have sex!!
Generally, male dogs that are neutered (testicles removed) do not produce testosterone and they cannot make sperm; they are indifferent to females in heat.
There are some male dogs out there who show sexual urge even after neutering. They do engage in copulation. The reason being dogs have os penis or bone inside their penis, Therefore, they do not require an erection to engage in sex. Of course, they will not ejaculate, but still, they can insert their penis inside the female dog's vagina.
Spaying and aggressiveness
They can still be dominant towards other dogs or people and mount them. Neutered male dogs do mellow out a bit in terms of aggressiveness, but they can still be aggressive and dominant. The most extreme behaviors of "red zone" attacks are carried out by intact males which is why the criminals who have dogs for fighting never neuter their dogs.
Neutering and spaying is responsible dog owner behavior, it's better for the humans, the dogs, and for avoiding unwanted puppies that are discarded and eventually killed.