never tried it myself but I believe you can build in caves, might have to toggle something off i don't remember. But there was a guy a long ways back now who showed off building bases in a lot of different places with screenshots, someone was even testing the limits of how high you can build with screenshots, might be the same guy actually. You can check out their posts, not that i remember the name to refer you to, those posts were somewhere around when that unbreakable wall mod got posted though so that can be a reference.
That was me. The
how-high-you-can-build thing, not the other one. The other one I think might have been from
UnknownLurkingUser. He was posting a lot of base screenshots around that time.
On a side note, I did build half of my base inside a cave for a while but I ended up moving it out. Mainly because of the bats. They were annoying as hell LOL. And they kept attacking (and destroying) my workbenches. Pests, I tell you. Anyway, it's not ideal. It doesn't even really stop raids, it's just that they can't reach their target if the target is inside the cave.
Although I did *once* find an enemy native inside my cave (just the one guy), and I still have no idea how that happened! Weirdest thing. Probably a bug.
BTW, building in the air DOES stop raids (assuming you're wearing the decoy charm). So there's that.