I’m still interested in a clear answer to the original question about why giving $NAME the lexical context of the passed-in syntax object is not enough.
I have attempted to give an explanation here:
The problem in the original was the macro expansion used name-pt without
adjusting the context. The identifiers were given a scope, so they could be used
in the code returned from parse-diagram, but not where parse-diagram was called.