While hiking in the Ruby Mountains of Nevada, I came around the corner and saw several mountain goats who had made several fairly large scrapes (3-4 ft long and a couple feet wide) in the ground.
Why would the mountain goats have done this?
Because they like it. It feels good, so they do it.
Many mammals roll in sand or dirt, presumably to keep parasites away or to help dry themselves after exercise or becoming wet. A sand roll, which is a stall or yard covered with deep sand, is traditionally included as part of stable complexes for use by racehorses after exercise.
Dust bathing has been suggested to have a communicatory function in several mammals source
When I raised goats I don't recall ever seeing a goat take a dirt bath. But Googling around finds several accounts of it.
I have observed these, I have seen dogs, goats, cats, wolves, etc scraping the ground. In some cases they sat onto it. In some cases they didn't. Following are cases where it makes sense:
Goats are mineral deficient and will often scrape and lick areas that contain urine to acquire needed salts. https://www.fs.usda.gov/detail/olympic/home/?cid=stelprdb5412239