The scene graph instancing export code contains logic for
determining which instances need to be converted to prototypes
because the original prototypes are not included in the export
(e.g., because they are not visible).
This commit fixes an error in this logic, which incorrectly
assumed that if the root of the original prototype is included
in the export, then the entire original hierarchy beneath the
root is included as well.
To fix this, the logic in AbstractHierarchyIterator::
determine_duplication_references was updated so that if any
descendants of an instance are converted to prototypes, the
parent instance is converted to a prototype as well.
This addresses the bug noted by Brecht in
https://projects.blender.org/blender/blender/pulls/131707#issuecomment-1403309
Pull Request: https://projects.blender.org/blender/blender/pulls/133750