Ensure PDB writer component is available before emiting PDB
Ported from
https://github.com/aspnet/KRuntime/commit/36cd4901f6b13d135b82dd026768a37ee36bdedb

Fixes #1324