The `UnresolvedLookupExpr` doesn't get looked up and resolved again
while it is inside the non-dependent context. It propagates into the
codegen phase, causing the assertion failure.
We attempt to determine if the current context is dependent before
moving on with the substitution introduced in the
20a05677f9.
This fixes https://github.com/llvm/llvm-project/issues/122892.
---------
Co-authored-by: Sirraide <aeternalmail@gmail.com>