fix Issue 9948 - -deps dependency printing incorrect for templates

This fix is based on the just merged pull request:

 https://github.com/D-Programming-Language/dmd/pull/2550

by @WalterBright 
It made this fix trivial (at least the test case in the bug report is working correctly now).