Process typedefs last when generating externs

Becasue typedefs sometimes use namespaces that are actually
constructors, we need to process typedefs after symbols to avoid
duplicate entries for such namespace types.

Partially fixes #2615.