Give root foreign objects the ability to register dependencies on others.

This will be needed by pointer fields, and also to give users the ability
to register custom dependencies.