As has been said by many posters, most dog-owners are responsible for their pets and have taken the trouble to find out their natural way of life and train the dog so as to adapt that to living amongst humans. A few either don't know anything about what a dog does naturally, want to treat it like a miniature human being, or don't care so long as they are not inconvenienced in any way themselves.
Take that good sniff around that a dog loves to do. It is reading the daily doggy newspaper, using its sense of smell, which is 10,00 to 100,000 times as sensitive than that of a human. Every dog that has walked this route has left a scent behind, which gets gradually weaker, so later dogs know who has passed along here and how long ago, whether they are fit or ill, male or female, and if female what phase of their reproductive cycle they are in. If a dog or bitch has pood here, the smell will last for another dog, even if it has been picked up and the area cleaned.
Dogs prefer to use a spot which has been used before, by them or by another dog, so they repeat the action - and leave more scent, much as a human will leave a comment to add their two-pennorth to an ongoing conversation. They also like to please the human with them - who can show their disapproval and discourage them from doing it the next time they pass the spot, or they can do nothing and allow it to happen.
This is how good owners train their dogs to be good dogs, and bad owners don't bother. House-training starts when they are puppies, when they are taught not to use the nice soft carpet as a toilet, but it doesn't stop at the owner's house.