Magma Crabs will also spit magma loogies at your dwarves, potentially melting body parts or simply igniting them. In previous versions, they spit globs of basalt, which were rather deadly. They've been toned down a bit, but are still hazardous.
Make cages near magma out of magmasafe materials if you want to avoid this. Nickel, glass, or iron would all be reasonable options. Since managing what cages are used where would require use of burrows, it's probably not worth it, and if you insist on using cage traps near magma and not having them destroyed, just make all your cages magma safe. Using weapon traps instead would be easier, unless you really want some captive magma crabs or something.
However, I suspect that caged creatures can not interact with their cage material. I believe the cage was damaged by contact with the magma crab before it was trapped, or possibly during the trapping process. The cage should not suffer further damage unless you put it in a refuse pile or have another magma crab walk over it, or otherwise set it on fire. So wooden cages should be safe for use near magma crabs. However, if you remove the crab and reuse the cage to catch another crab, it may suffer more damage, and would eventually be destroyed, possibly failing to catch a crab. Probably not too big a deal, unless all the cages in all the traps get destroyed by the same wave of crabs, which is unlikely.