[ONNX] Stablize eraseTupleConstruct
Previous implementation is prone to segfault, as it is inserting
new outputs to block while iterating over block->outputs().
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75920
Approved by: https://github.com/garymm