Simple QOL suggestion today so let’s hop into it.
When regenning terrain, check for any NPCs, holdables, Animals, or Players. If there is anything inside when the terrain regenerates fully(like able to be stood on), we can assume whatever was in that terrain is stuck, and should be teleported up to the surface.