hir: Refactor getters for owner nodes
For more information about how rustc works, see the rustc dev guide.