CB-7602: Fix isCopyOnItself logic

It should not treat /a/bc/ as a subdirectory of /a/b/