The purpose of `NodeTreeRef` was to speed up various queries on a read-only `bNodeTree`. Now that we have runtime data in nodes and sockets, we can also store the result of some queries there. This has some benefits:
* No need for a read-only separate node tree data structure.
* Makes it easier to make reuse cached queries in more parts of Blender that can benefit from it.
I downside is that we loose some type safety that we got by having different types for input and output sockets, as well as internal and non-internal links.
This patch refactors `DerivedNodeTree` so that it does not use `NodeTreeRef` anymore but uses `bNodeTree` directly.
Todo:
* Remove remaining usages of `NodeTreeRef`.
* Decide on an api.