|f| is periodic implies f is periodic
The mistake is that you're playing too hard and fast with the $\pm$ symbol.
You have concluded correctly that for each particular $x$ it is true that $ f(x+p)=\pm f(x)$. Or in other words, for each $x$ either $f(x+p)=f(x)$ or $f(x+p)=-f(x)$ holds. But this doesn't tell you that it will be the same of these for every $x$.
Written symbolically (and without the $\pm$ symbol), what you have concluded is $$ \forall x \; \exists k\in\{-1,1\} : f(x+p)=k\cdot f(x) $$ but you're trying to use it as if it were $$ \exists k\in\{-1,1\} \; \forall x : f(x+p)=k\cdot f(x) $$
The $\pm$ symbol can be confusing in this way because it implies a quantifier but leaves no way to express what the scope of that quantifier is. It is best avoided when you're trying to be rigorous -- except, perhaps, when you're extremely sure it will be clear to everyone what the shorthand actually means in each particular case.
Your mistake is in the last line. $|f(x+2p)| = |f(x)|$ so $f(x+2p) = \pm f(x)$. However, you can't guarantee which of those it is.