[Issue 9571] Proof-of-concept fix for emitting only required template symbols

Don't have easy access to different OS and linking is quite platform-dependent, so I'll abuse pull tester a bit ;)

This pull attempts to clean up template symbol emitting to object files. Currently all of them are generated to object file associated with module supplied to the command line. For separate compilation scenario that means that ALL template symbols from ALL imported modules are emitted into compiled single module.

Most time it is just extra job for linker, but sometimes this results in nasty bugs when resulting symbols are not weak ones (issue 9581 is exactly one such case).

After this pull request is merged dmd will try to find root module where template instantiation chain has started via call from non-templated scope. Implementation improvementn suggestions are welcome, of course, this is quick and dirty attempt.