If a nested group has generics and a particular type has resolved those generics, this information is lost when processing the nested type as we use the TypeElement as the source rather than the DeclaredType of the actual instance.

There is a test that shows this limitation concretely where T could have been resolved if we were using the return type of the field rather than the class definition.

We should rework TypeUtils to work with DeclaredType rather than TypeElement.

Follow-up of #16451