Origin of cud chewing

I realize that evolutionary questions may be difficult to answer. But I wonder how ruminating evolved from simple eating > mouth >> stomach, which appears to be the ancestral way, and back to mouth ?

regurgitating food is quite common in animals, for instance to feed the young in birds and dogs. So one way trips through the alimentary system is not always the norm.

The dog returns to its vomit.

Just a storage and transportation solution.