How to make cave pieces modular so they are seamless?
You need the vertices at each connection pint to be perfect matches for each other, and you need them to have the same uv coordinates. These are nontrivial tasks, but I do have a few recommendations:

First, consider working without a subsurf. That way you can have all cave entrances and exits be exact copies of each other.

Second, uv unwrap a cave segment with the maximum number of exits intended first, then make all subsequent caves start as duplicates. Unwrap these but pin the verts of the exits when doing so.

Finally, make sure you have exact coordinates and angles for all exits relative to each other so that your game engine can get them into place.

I have never done this, but it sounds plausible!