Regarding the OP, I think we really should strive to have something to fix this issue.A poor-mans distinction could be done by checking whether the GC is currently the one destroying (a flag is available, but isn't publicly accessible), though that could get expensive.
That's essentially what Guillaume's "GC-proof resource class" idiom does now.
https://p0nce.github.io/d-idioms/#GC-proof-resource-class
