(Move to the TL;DR section if you don’t care about the context.)
So I was digging too deep when I found some giant cave spider. I think I was bothering it, since it proceeded to decimate my fledgling military. Once I had managed to calm it down, er, permanently, the tunnel revealed another welcome guest; a forgotten beast. This monster, which apparently took the appearance of a giant grasshopper made of iron and with five or so mouths, then tore right through a door blocking off the mines in my fortress from the rest of the place.
Now, what remains of my military is fighting the beast, but I am sensing their inevitable failure. Thus, I need to enact Operation: Grasshopper Blocker, which consists of me building a wall. However, remembering that the grasshopper could destroy doors, and knowing that giant cave spiders (which I’m sure there are more down there) are building destroyers, I am uncertain whether or not my wall would be enough.
TL;DR Are constructed walls (wooden and other) safe from building destroyers?
Followup question: is it possible to cause a cave-in that will permanently close a passage?
Yes, constructed walls are safe from building destroyers, as walls are a type of construction rather than a type of building.
From the Building Destroyers page of the DF wiki:
Constructions (walls, staircase, floors, etc.) are still safe, since they’re processed the same way natural terrain is for most situations.