This is a continuation of to Starcounter/starcounter-include#17, because after some research, I have managed to further isolate the problem to imported-template.
The problem is that nodes stamped by dom-if are duplicated when the parent node of imported-template is detached and then attached to DOM
I have written a test that fails in imported-template. I will commit it to a branch.
I think that the problem is between imported-template and Polymer, because using only Polymer this works as desired: https://jsbin.com/pesece/1/edit?html,js,output)