Fix type/shape inferencing double recursion for subgraphs (#29617)
### Description
<!-- Describe your changes. -->
The secondary recursion in VerifyNodeAndOpMatch results in recursion on
top of recursion for operators that do subgraph recursion via the ONNX
type/shape inferencing path.
For a model with deep nesting this results in model load taking an
extreme amount of time.
Memoize the subgraphs that have been processed to avoid this.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->