Never met a dog that would do that, ever. But there are oddities among all species. I have a cat that responds nicely to numerous verbal commands, a first in more than 40 years.
As for spraying, that is a function of neutering, male or female. A neutered cat that pees out of the box is either suffering from urinary problems (which happen very commonly because people feed crap food) or has territoriality issues with other cats in the house.
I live in an urban area. Letting any animal roam outside would be beyond the height of irresponsibility (and in general is unless you live in an extremely rural area, and when I had horses, loose dogs were a reason to get the gun). Heck, I consider owners who walk their dogs without leashes around here inconsiderate as hell. I mean, my own son was hit by a car (not hard, but it happened) about a block from the house. One of my dogs was killed right next to the house. Last summer we had to dispose of someone's cat that was lying in front of our house, you get the point.