In the original code, `counter` counts the number of times `set.add()` is called. It keeps repeating until `counter`reaches at least `factorial`, so at least it calls `set.add()` the right number of times. Your proposal calls `set.add()` only `subStrings.size()` times, which is clearly not enough.
As it turns out, the original code was buggy, and tried to add some of the same permutations twice, resulting in an incomplete set. But at least it tried to call `set.add()` the right number of times.