Well, the game already tracks the accessibility of locations to each other. This means it must run the pathing algorithm, at least when accessibility matters, to see if you can path to a location. Also, Dwarves check if they can path to a specific job before they take it on, or at least before they move.
This means that there is a crap-ton of information being produced all the time about where there is open walkable space. If this information could be saved and culled only for areas considered "inside," then the engine has a way of checking only a subset of the map area where cave-ins would matter, as 1: if a dwarf can mine or build something, then it must be able to path to it and 2: only mining or building something can lead to a location that can cave-in, assuming world gen can take such things into account either explicitly or implicitly.
Since your fortress likely only includes no more than 10% of the total volume of the map (in standard play), and if the pathing information is compressed enough, this should give the CPU enough hints to check only a small subset of the total map for cave-ins. Ideally, you'd set up a really dump algorithm that can determine, with very few operations, if a given tile cannot support itself. Something like IF (solid density * volume constant) > (shear strain max), THEN COLLAPSE. If you normalize shear strain in by dividing by a volume constant at load time, then it is a simple comparison. That pushes the collapsed tile onto a stack of collapsing tiles, which cause the engine to check surrounding tiles next frame (with higher priority than the rest of the check list). A "has changed" flag on the check list also speeds this up and is easy to determine. You'd still get some lag with mining, but with some tweaks this could be minimized (check only every fifth frame, etc., or maybe a dynamic check spacing).