Revert "Removed CMARK_NODE_REFERENCE_DEF from API."

This reverts commit b598b52a4acdc2332be3d34e30237d1b93b7dd03.

The change led to some problems, because some of the callers
of 'finalize' expected the node to exist after the call.
This could all be rewritten, but for now let's just revert.