\documentclass{article}
\usepackage[hidelinks]{hyperref}
\usepackage[makeindex,nomain]{glossaries-extra}
\newcommand{\goodDomain}{\mathop{\gls{good}}}
\newcommand{\anotherGoodDomain}{\mathop{\gls{anotherGood}}}
\newcommand{\badDomain}{\gls{bad}}
\newglossary[nlg]{notation}{not}{ntn}{Notation}
\makeglossaries
\glssetcategoryattribute{unaryop}{hyperoutside}{false}
\glssetcategoryattribute{unaryop}{textformat}{mathop}
\glssetcategoryattribute{anotherunaryop}{textformat}{mathrm}
\newglossaryentry{good}{type=notation, name={\(\mathrm{dom}\)}, text=\mathrm{dom}, sort={mapDomain}, description={A good domain of a function}}
\newglossaryentry{anotherGood}{type=notation, name={\(\mathrm{dom}\)}, category=anotherunaryop, text=dom, sort={mapDomain2}, description={Another good domain of a function}}
\newglossaryentry{bad}{type=notation, name={\(\mathrm{dom}\)}, category=unaryop, text=\mathrm{dom}, sort={mapDomain3}, description={A bad domain of a function}}
\begin{document}
\noindent$x\in\goodDomain f$\\$x\in\anotherGoodDomain f$\\$x\in\badDomain f$
\printglossaries
\end{document}
