How to recover agent when their area is cut off?

Just wondering if there is anything built into astar that might help with this situation, or any other advice.

I have dynamic building/object placement at runtime.
Each time an object is placed the recast graph is updated to cut out that area.
That all works great.

There are scenarios where you could encircle an AI with cutouts effectively separating the navmesh they are on from the rest of the graph making it impossible for them to get out of that area.

For example, place a bunch of walls around an agent. They are now stuck in the middle of those walls and can’t generate a path to get out.

My expectation is that I’ll have to code my way out of these scenarios (like pathing to the nearest wall and climbing out, or allowing them to pass through those obstacles etc), or put in some simple teleport recovery if they can’t generate a path etc.

But, any other suggestions on ways to handle situations like that?

not sure if it works on recast graphs but perhaps using a GraphUpdateScene script on the wall object that tags instead of removing, and give the wall tag a large penalty for traversing, and somehow detect if the character is on the tag to see if they need to climb
just an idea