If memory serves, most moats are artificially created and stagnant so there is little water movement, and the castle would be built on some pretty solid ground that would be tightly compressed during the actual building so erosion didn't usually factor in.

Even the castles built with natural moats were actually built in an area that had a tidal flow and the castle would be on an area that didn't experience the erosion - solid rock as you suggested or very dense earth.