The creatures eat rocks. The excreta from this is fertile loam that is ideally suited to farming.
They can be trained to eat from rock formations in such a way as to create walls and fortification.
If they eat a metal ore, the metal part is not digested and can easily be separated from the loam to produce pure gold/silver/iron etc.
A problem is of course that in the wild they take chunks out of random mountains or even stone castles if not carefully monitored. Thus the landscape will tend to become flatter over many millennia.
There may be some huge underground caverns and tunnels where they have made a den.