The trick with CSG2 was to cap both ends of the extruded tunnel shape (cap:BABYLON.Mesh.CAP_ALL) so it is recognized as a solid. For good measure, I also closed the shape (closeShape:true) and removed the end point that repeated the start point.
I put a bump map (normal texture) on the ground. I also created a smooth material with the hope to put that material on the inside of the tunnel. But couldn’t figure out how to do that only on the inside of the tunnel.
I removed all the masking stuff, too.
Edit: assigning the smooth material to the tunnel shape before converting to CSG, and removing the “useMaterial” option when converting back .toMesh(), results in the smooth material in the tunnel while the normalTexture is retained on the ground surface.