Refactored ReferencesDomain and RefDomain, closes #17015