Free idempotent semigroup with 3 generators
There are indeed infinite square-free words, but it does not prove that two distinct prefixes of an infinite square-free word cannot be equivalent under the congruence generated by the congruence $x = x^2$. Here you just considered the rewriting system $x^2 \to x$ and simply ignored the possibility $x \to x^2$. For instance, you will find in [2] a detailed proof that $bacbcabc \sim bacabc$, although these two words are square-free.
As proved in [1], the number of elements of the free idempotent monoid on $n$ generators is $$ \sum_{k=0}^n \binom{n}{k} \prod_{i=1}^k\ (k-i+1)^{2^i} $$ See [2, Chapter 2] for another proof. For $n = 0, 1, 2, 3, 4$, one gets successively the values $1, 2, 7, 160, 332381$. This is A005345 in the on-line encyclopedia of integer sequences.
[1] Green, J.A., Rees, D.: On semigroups in which $x^r=x$, Math. Proc. Camb. Phil. Soc. 48, 35–40 (1952)
[2] Lothaire, M., Combinatorics on words, Encyclopedia of Mathematics and its Applications 17, (1983), Addison-Wesley Publishing Co., Reading, Mass. New edition (1987), Cambridge University Press, ISBN 978-0-521-59924-5.