Fix Issue 13478 - [REG2.066] Templates not emitted when also referenced in speculative contexts

https://issues.dlang.org/show_bug.cgi?id=13478