If he was doing it while she was peeing, he may have been trying to pee over her pee. Dogs do this in households as a hierarchy thing. He who pees last over everyone else's pee is king.

I would also stay away from aversive punishment while he is peeing outside. You run the risk of undoing all your potty training. Dogs don't really make associations with their actions as we do - he may see it as "don't potty outside!" and not "don't pee on the other dog!"