Or, we can just have the destruction project fail.
In some cases it can be impossible to empty parent building enough. Extension can have further extensions and amount of objects inside can be almost unlimited. It would mean that almost successful destruction project can't be finished, so time is wasted without any result.
After some thinking I believe the best thing to do with buildings overcrowded because of extension's destruction is to ignore it. Temporary overcrowding won't cause more trouble than current state of affairs. Somebody who is destroying extension should move all possible objects somewhere else to avoid own troubles. When room gets blocked then destroyers will be able to go outside and perform destruction project again for parent building.
With ships: single hold can store less stuff than ship's deck, so it's extremely hard to cause accidental overcrowding.
But if it happens then we can ignore loss suffered by destroyers, because it was their decision to start destruction. And there will be no damage for people who were trapped inside of hold. Their situation won't become harder than was earlier.
But if it happens then objects must be dragged somewhere else before leaving the boat (if piles are small enough) or we need to implement at least one of suggestions: moving part of pile, dragging raws from outside (especially this one is good). Otherwise piles will have to be moved by staff members. And it's not good idea.