As part of this, we move template compilation to happen before we queue up deferred generation; the compilation step should be plenty fast enough that we can reasonably do that synchronously and report any compilation errors back to the peer.