Prevent invalid binding in re-written templates

With string templates, if the HTML is invalid in some way, the browser will attempt to fix it, often by removing invalid elements. If that invalid element has a binding, Knockout still tries to do that binding on whichever element is after it.

We fixed a particular consequence of this in #660, but should probably fix the problem more generally. Likely this will mean that we track the `tagName` of the binding's element and ensure that the binding is applied to an element with the same name.