My dog does this any chance he gets as well. If he's on a leash, I try to always remember to direct him away quickly. If he's in the yard, I try to get his attention before he does it. It's so gross!
He also wants to eat his poo. Yesterday he squatted right on the sidewalk while we were walking. While I was getting out the plastic bag, he gobbled it up before I could even react! I usually try to snatch it up as soon as I can, but he took me by surprise that time!
Even worse, today he pooed in my cubicle at work. He has very few accidents at work, I was really surprised. I didn't even notice, until I smelled something, and looked down and he was just about to snarf down a little piece, so I have a hunch he already ate part of it. So not only did he poo inside, but he also got rewarded for it (assuming he enjoys eating the poo.)
GROSS!!!