Add TemplateInstance::tnext to construct instantiation dependency graph

To detect speculative instantiations in codegen phase, `tnext` is neccesary for the `test6()` case `runnable/link13350.d`. That's a big difference from the PR #2550.
Merge pull request #3948 from 9rnsr/fix_tinst

Add TemplateInstance::tnext to construct instantiation dependency graph