Chet Ramey (Bash maintainer) says
There was extensive discussion about namerefs on bug-bash earlier this year. I have a reasonable suggestion about how to change this behavior, and I will be looking at it after bash-4.4 is released.
In the meanwhile, I'm resorting to slightly obfuscate the names of my local nameref variables, so that they don't clash within the library nor (hopefully) with global shell variable names.
In bash 5.0, this is ever so slightly remedied (but not really fixed). The following is the observed behaviour:
$ foo () { typeset -n var="$1"; echo "$var"; }
$ var=hello
$ foo var
bash: typeset: warning: var: circular name reference
bash: warning: var: circular name reference
bash: warning: var: circular name reference
hello
This shows that it works, but that there also are are a few warnings.
The relevant NEWS entry says
i. A nameref name resolution loop in a function now resolves to a variable by
that name in the global scope.