The Go programming language has a "defer" statement which is used considerably for exactly this purpose. So we know that it's useful in practice. The question remains what is a good way to introduce it into Bash.
As others have noted, there is already a "trap" with similar functionality. I'm not familiar with it, but it seems that it does not have "signal" choices that cover the the situation(s) we want "defer" to be triggered by. However, that seems to be a straightforward extension. More important is "safely appending to a trap can be filled with holes". Why don't we allow a trap to be a sequence of strings, and define a new option to "trap" that prepends the argument string to the sequence? (Go specifies that "defer" actions are executed in reverse order from the execution of the "defer" statements that establishd them.) This approach seems to have the functionality we want while being a small extension of an existing, similar mechanism. Dale