It should really use the parent link and not depend on the context id. After all I can walk in and use the general perms UI to break context-id. That's one very good reason not to depend on context id to point to a physical parent.
I know other packages do this too but personally I think they're all broken.
The CR may already provide something like this. If not, one way of doing it would be to use tree_ancestor_keys to grab the set of ancestors - "in (select tree_ancestore_keys ..." rather than recurse.
It would be faster. Regardless CR objects should use a standard CR way rather than depend on a context_id hack.
You could use the same trick for forums, too, since the message sortkeys *do* reflect physical reality, no?