[tree] FIX level in MaterializedPath

If 'path_starts_with_separator' or 'path_ends_with_separator' are set, tree level is wrong. This patch will fix it