Water in all its forms is absolute worst thing you can have around buildings.
So goal for any and all buildings should be to site them in such a place, build them in such a way that water always, always flows away from them vs towards them or is allowed to linger around them. Easier said than done. Especially so around livestock buildings, with their foot traffic in and out. Over time, they always manage to create low spots around the high traffic areas that begin to resemble little moats. I've seen these around cattle barns and feedlots that were so bad their bellies were dragging through the mud with each pass.
BTW, I am dealing with this myself. The uninformed folks who built the horse barn where I live now placed it where they did because X marked the spot where they wanted it to be. But in doing so, they failed to take notice of the obvious and placed it straddling an old farm terrace. The one that collects and concentrates surface water into a channel that flows straight into the side of the barn, where the natural drainage would have it flow under or through the barn, emerging on the other side. When I got here, a 1 inch rain would have 8 inches of water ponding on the uphill side. They had installed some drain tiles through the terrace so as to bypass the barn, but these were not nearly deep enough. So this barn, and the adjacent area where they set up their water tank for their horses, has mud problems. The area around the water tank where their horses stood was nearly a foot lower than the adjacent surface. Their horses did that over time and it was only going to get worse as time went on.
The solution is simple. Gravity works. So ALL buildings should be placed on top of what from a distance would look like an inverted bowl. The building is elevated and water flows away from it. (Mine looks like it was placed in the upright bowl......and acts like it). If it wasn't elevated when it was built, the only solution is to lower the ground around it, or install drainage around it to allow gravity to take over and give the water a place to go other than standing around to cause problems.
Looks to me like you had the right idea with the grass hay. Elevating them up and out of the mud. It may be nasty down deep, but up top where they are, high and dry?