Where is the mistake in my reasoning?
Your work is perfectly correct. But I'm pretty sure you misinterpreted the original question: there should be $\color{green}{32}$, not $\color{red}{3^2}$, in the given data. With that value, the same work as you did will indeed yield $4$ as the final answer.
Suppose $a^2+b^2+c^2=2$ and $(a+b+c)(1+ab+bc+ac)=k$. Then, setting $s=a+b+c$ and $q=ab+bc+ac$, we get $$ s^2=2+2q=2(1+q),\qquad s(1+q)=k $$ Therefore $1+q=s^2/2$ and $$ s^3=2k $$ so that $s=\sqrt[3]{2k}$. If $s$ has to be $4$, then $2k=64$, that is, $k=32$.