I know that if $c_1$ and $c_2$ are two codewords in a linear binary code $C$, then $c_1 + c_2$ is also in $C$.
However, does the definition of linear (binary) code (as a subspace of $\mathbb{F}_2^{n}$) implies that $E(c_1 + c_2) = E(c_1) + E(c_2)$, where $E$ is some encoding function?
Since Hamming code uses a generator matrix $G$ to generate code, it satisfies $G(c_1 + c_2) = G(c_1) + G(c_2)$. Is this valid for all linear codes? Or, are there linear codes that do not satisfy $E(c_1 + c_2) = E(c_1) + E(c_2)$ for encoding functions $E$?
No, that is not implied by the definition of a linear code. The definition of a linear code is not related to the encoding function, only with the (unmapped) set of codewords.
(Definition of binary linear codes from Lin & Costello):
So, strictly speaking, it can well happen for a linear code that $E(c_1 +c_2) \ne E(c_1) + E(c_2)$. For example:
$$c_1: 00 \to 100$$ $$c_2: 01 \to 110$$ $$c_3: 10 \to 010$$ $$c_4: 11 \to 000$$
This is a linear code (the codewords form a linear subspace), but the encoding function is not: $E(c_1+c_2)=E(c_2) \ne E(c_1) + E(c_2)$
However, it's easy to show that given a set of codewords that form a subspace (which is to say, given a linear code), an encoding function can be used that is also linear (and which can be expressed as a generator matrix, which is multiplied by the input). And, in practice, that's always preferred.
(Incidentally, that's also why every "real" linear code maps the zero input to the zero codeword - a property that is not strictly required for having a linear code, but for having a linear encoding function).