It’s for parts, I know, but you can just reverse-engineer it to make it work for terrain.
Alternatively, a bit unrealistic method is to use bezier curves. Take 2 points, the start and end for a cave, and add more points that act a a control point. Then you can use code to sort of simulate a “worm” that eats up existing terrain.