[flang] Avoid crash in name resolution on erroneous type extension (#109312)
Don't crash when a bad Fortran program tries to extend a derived type
with previous legitimate forward references but no prior definition.
Fixes https://github.com/llvm/llvm-project/issues/109268.