Fix email rendering when using 2 different plugins.

When an email template and layout are in different plugins the incorrect
plugin would be used for the layout.

Fixes #3062