Not sure what ELF and C type system has to do with this. C type information can be stored in ELF (as well as many other things). This is how a debugger can know the types.
It is simply a language design flaw of C++ that class implementation (not just templates) ended up in the headers.
ELF files based on the C type system can't provide such information on object files, and binary libraries.
In the modules world it can read it from the symbol table on the BMI, like in any other module based language.