Make the captureStackTrace polyfill more real.

We also need to move it to the top so that it’s available when the
libraries are all loaded.