I would have assumed it was because they itch.
My male was fixed before I got him, so around here we're all spared the indignity of observing that, ah ... joyous activity. But for those dogs who are intact, I guess that they, in their own way, give thanks to the Intelligent Designer.