unit tests: Don't mess with template retrospectively

In a couple of places we were modifying the template after creating the
stack with it, which is obviously not guaranteed to work.

Change-Id: I572cf6d7ac58392a9eb983ba8602481d0123c401
Merge "unit tests: Don't mess with template retrospectively"