[ONNX] Look at owningBlock instead of graph when recording autograd subgraph (#82852)
Small adjustment to ensure the node always exists. `graph->nodes()` might not contain
the autograd node, if it resides in additional subgraphs.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82852
Approved by: https://github.com/shubhambhokare1, https://github.com/abock, https://github.com/malfet