I have a friend who's dog does the same thing, but outside the house, in the garden.

Its just a nasty habit. I suggest a different arrangement for the litter box. Maybe something around it that won't allow the dog to access it.....maybe a cat door to the box in a closet? Or a smaller opening in the box.

Good luck. Its pretty common so don't feel as though you have the only dog eating....well, cat poop.