bemhtml: introduce tree structure checks

n/t

We have a lot of problems with a missing _mode predicate in some of the templates. When it is not present - whole tree structure of the compiled bemhtml.js becomes wrong and very slow. This patch will print warning in case of getting oddly-shaped tree after compilation.