It’s tricky automatically instructing them to build a ladder or something because someone else might be on their way to do just that already, or because the area in which they’re trapped might not have a clear location from their perspective of where to build a ladder. I’ve put a little thought into this, and the best I came up with for the time being was my What’s Stuck mod that alerts you when they’re stuck, but relies on you to actually get them unstuck: Paul the Great's modding vertex
Sounds pretty reasonable and simple, we might add it to ACE.
As Relyss says, there’s a mod that does exactly that. We also incorporated it into ACE, and are transitioning to having it function more like issuing orders rather than having to construct/place items.
I think this has been brought up before at ACE, so it (not necessarily your proposed solution) might get implemented in some form.