In general, the extended code $C'$ is linear if and only if the map $C \to \mathbb F_q$, mapping a codeword to its extension symbol is linear.
In your case, the extension may or may not be linear, depending on the original code $C$. The problem is that squaring is not linear, normally.
However, there is a large class of cases where we can directly answer the question:
If $q$ is even, then squaring is an automorphism of $\mathbb F_q$ (Frobenius automorphism) and thus, the extension rule is indeed linear. So whenever $q$ is even, $C'$ is linear.