Properly remove in-memory references (#25652)
<!-- Describe your changes. -->
Make Node::ToProto() const
call Graph::ToGraphProto() const so it does process all of the
subgraphs recursively and removes all the in-memory references.
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Node::ToProto() const does not respect constness of subgraph attributes
and calls non-const version of Graph::ToGraphProto() which does not
process
subgraph initializers and does not remove in-memory references.