Establish semantic separation between template and traversal ID

We currently use the template ID for the stack both to find out the ID
of the template and for identifying a traversal of the graph. This patch
separates the two uses by giving the value semantically appropriate
names.
Use a unique ID to identify traversals

Previously we used the template ID to identify the traversal. However
this is not necessarily unique, as the user can roll back to a previous
template. That could result in operations from a previous, interrupted
attempt to update continuing while a second traversal also starts. That
could have advantages, but most likely its a bit too clever and will
result in painful debugging later on.

This patch provides an incrementing traversal ID instead.