Correctly create the template object in `BaseTemplate::insert()` (see #7366)