Additional fix for issue 10567 in order to generate correct TypeInfo

The change introduced by #2321 was not good for separate compilation.

Read the comment in `AggregateDeclaration::semantic2`.