[runtime] Fix the lookup of nested types which have a namespace. Fixes #21653.