Did your dogs roll in their own poop, or other dogs' poop, or other animals' poop?
One simple reason might be they simply like the smell of poo. They might find it so appealing that they just want to roll in it. Yep, they have very different preferences compare to us. You can't blame them for liking something we feel gross.
One of the other theories I have heard is that the dogs ancestors - wolves might have tried to conceal themselves by rolling in other animals' poop. With their own scent covered up by the smelly poo, they can sneak up on other animals without being noticed. They were predators after all.