Your question is based on a false premise.
However, in the equation $2x=4$, $x$ can only be the value or values (from the some given set of real numbers) that makes the equation true.
No! In the equation "$2x=4$", $x$ is merely a variable, and the equation is meaningless without any further context. You can ask many different questions about that equation, such as what real $x$ satisfies it, or what is its graph in the (cartesian) $(x,y)$-plane (it is a vertical line), or what are the free variables in it (just $x$), and so on. Furthermore, that equation may be just one part of a larger expression such as "$∀x∈\mathbb{R}\ ( 2x = 4 ∨ ∃y∈\mathbb{R}\ ( (x-2)·y = 1 ) )$", in which certainly $x$ is not only "the value or values that makes the equation true".
"$2x=4$" is an equation, but equations do not imply anything about the symbols in them. "What real $x$ satisfies the equation $2x=4$?" is a question with a well-defined answer. If you do not specify "real", then it is not only not a well-defined question, but also a common example of imprecision. Namely, "Solve $2x=4$." is not a precise question.
An equation is a (mathematical) statement of the form "$A = B$" where $A,B$ are terms (also called expressions). A statement has a truth-value once all its free variables have been bound (i.e. their values are specified). Namely, "$2x=4$" has a truth-value once you specify what $x$ is. Hence it is meaningful to ask what real $x$ satisfies that equation (i.e. what value[s] for $x$ makes that equation true).
"$2x$" and "$4$" are simply terms, and "$2x$" is a compound term built from the terms "$2$" and "$x$", where multiplication has been represented by juxtaposition. Yes, every variable is also a term, and as with statements, terms are meaningless until you specify the values of all its free variables.
So the $x$ in "$2x$" and "$2x=4$" are actually exactly the same kind of variable, and mean exactly the same thing. Just as you can ask a question about the equation "$2x=4$" (e.g. what real $x$ satisfies it?), you can likewise ask a question about the term "$2x$" (e.g. what real $x$ makes it equal to $4$?). No difference.