Your example is counter intuitive: why does the last assert(foo==3) has to be true (the outer scope was modified by the double-inner scope use of "unset": why does then foo=3 would not affect instead the middle scope and then throw an error on assert(foo==2)?
If that "assert(foo==2)" passes then the "unset foo" has no effect than just being equivalent to "local foo -- =nil" and then the last assertion assert(foo=3) should fail because foo is still equal to 1.
Your idea would create a security havoc where programs can unhide the protection layers to get access to internal variables being normally inacessessible to them.
The only safe behavior would be that "unset foo" is like "local foo" (so "unset" is not necessary at all) but still different from the assignment "foo=nil" which overrides the value of the same variable in scope (only the former value of that variable will be closed and garbage collected, but the scope does not change: that same variable continues to used in other references, notably in other function closures).
Alloing a program to control the scoping of outer varisables they did not declare themselves is a crazy and dangerous idea.