In current readfile.c code we have that:
This is unconditionally clearing nodetree's recalc flags, and was added by rB81a762e79f83 ages ago. Thing is, in main ID read code we only clear that flag when not in undo context.
This proposed change intends to properly handle those cases, by moving id.recalc flags clearing from read_libblock() to direct_link_id(), which is also called for all 'local' IDs (ntrees and master collections currently).
I’d expect that change to be straightforward (and maybe even fixing some odd undocumented bugs), however there is no .blend file testcases associated with changes in rB81a762e79f83, so wouldn’t mind that to be double checked before it goes to master.