The problem seems to be, that in the innermost list <ul class="category-mega-menu dropdown">
is used instead of <ul class="dropdown">
.
If you can’t make it work by using “tplCategoryFolder” instead of “tplCategory”,
then maybe try a solution like described here, where you output a different value based on the level.