Substitute type params in default type params using them.

Fixes #11964 and closes #8998.