BF: add tie-break for tag distance

Take into account tag paths where one tag is further along the same path
as another.

[skip ci]