Note that
$$
(x^3+x^2+1)(x^3+x+1)=x^6+x^5+x^4+x^3+x^2+x+1
$$
over $\mathbb{Z}_2$, and those cubics are irreducible as they have no roots in $\mathbb{Z}_2$.
In general, $X^{q^n}-X$ is the product of all monic irreducibles over $\mathbb{F}_q$ with degree dividing $n$, so in this case, $X^8-X=X^{2^3}-X$ is the product of all monic irreducibles over $\mathbb{Z}_2$ with degree dividing $3$. You factored out the two monic irreducibles of degree $1$, so it made sense to look for the monic irreducibles of degree $3$, which would give the factorization.