Ensure parent refs are deleted before force-deleting resource records

* This most commonly happens with shaders and programs. A program record
  takes a reference on shader records when they are attached and linked,
  then a shader can be orphaned with only that reference remaining if the
  user code detaches and deletes it.
* Previously we would go through, force-delete the shader, then when we
  force-delete the program things would explode since it tries to decrement
  the refcount on the shader and it becomes -1. So now we make all records
  remove their parents (which might delete their parents), before we force
  delete them.