The complete factorization of both numbers and polynomials is unique. The keyword here is "complete".
$56$ can be factorized into irreducible prime factors $2\times 2 \times 2 \times 7$ the same way as $p(x)=x^3+3x^2+3x+1$ can be factorized into the product of irreducible simple roots $(x+1)^3$. These factorizations are unique (up to ordering and signs of the factors).
Expressing $56$ both as $8\times 7$ or $2\times 28$ is the same as expressing $p(x)$ both as $(x+1)^3$ and $(x^2+2x+1)(x+1)$. It is just a non-unique way of multiplying prime factors with each other.
I hope this clears up any misconceptions.