This commit fixes several critical issues with previous code:
* It only covered a (very small) subset of potential ID references in a
node (namely, just the `bNode::id` pointer).
* It completely ignored linked data case.
* It would modify ID pointers in the clipboard itself.
The new code stores ID reference info in a separate mapping. It uses the
new 'sub-data' foreach_id feature from `BKE_lib_query` to reliably and
generically process all ID pointers of a node.
The paste handling of ID pointers is split in two steps:
* All knowns ID references are searched for in current Main data-base,
and the result (current valid ID pointer or null if not found) is
stored temporarily in the ID references mapping.
* Once a node has been duplicated from the clipboard into the paste
destination nodetree, its ID pointers are updated accordingly.
This allows to keep the 'reference ID' data in the clipboard always
valid, regardless of which IDs are currently existing in Main (i.e. to
keep all available data, even when opening new blendfiles, or doing
undo/redo that would affect the existing IDs).