Which tricks do people use to introduce rigor into identities like $(x^2)'=2x$? The "school identities with derivatives", like
$$
(x^2)'=2x
$$
are not identities in the normal sense, since they do not admint substitutions. For example if we insert $1$ instead of $x$ into the identity above, the appearing equality will not be true:
$$
(1^2)'=2\cdot 1.
$$
That is why when explaining this to my students I present the derivative in the left side as a formal operation with strings of symbols (and interpret the identity as the equality of strings of symbols). 
This however takes a lot of supplementary discussions and proofs which look very bulky, and I have no feeling that this is a good way to explain the matter. In addition, people's reaction to this my question makes me think that there are no texts to which I could refer when I take this point of view.
I want to ask people who teach mathematics how they bypass this difficulty. Are there tricks for introducing rigor into the "elementary identities with derivatives" (and similarly with integrals)?
EDIT. It seems to me I have to explain in more detail my own understanding of how this can be bypassed. I don't follow this idea accurately, in detail, but my "naive explanations" are the following. I describe Calculus as a first-order language with a list of variables ($x$, $y$,...) and a list of functional symbols ($+$, $-$, $\sin$, $\cos$, ...) and the functions which are not defined everywhere, like $x^y$, are interpreted as relation symbols (of course this requires a lot of preparations and discussions, that is why I usually miss these details, and that is why I don't like this way). After that the derivative is introduced as a formal operation on terms (expressions) of this language, and finally I prove that this operation coincide with the usual derivative on "elementary functions" (i.e. on the functions which are defined by terms of this language). 
Derek Elkins suggests a simpler way, namely, to declare $x$ a notation of the function $t\mapsto t$. Are there texts where this is done consistently? (I mean, with examples, exercises, discussions of corollaries...)
@Rebellos, you identity
$$
\frac{d}{dx}(x^2)\Big|_{x=1}=2\cdot 1
$$
becomes true either if you understand the derivative as I describe, i.e. as an operation on expressions (i.e. on terms of the first order language), since in this case it becomes a corollary of the equality
$$
\frac{d}{dx}(x^2)=2\cdot x,
$$
or if by substitution you mean something special, not what people usually mean, i.e. not the result of the replacement of $x$ by $1$ everywhere in the expression (and in this case you should explain this manipulation, because I don't understand it). Anyway, note, that your point is not what Derek Elkins suggests, since for him $x$ means a notation of the function $t\mapsto t$, it can't be substituted by 1). 
 A: There are at least a few approaches to this.
At a conceptual level the key is that differentiation acts on functions, not numbers. This leads to the first approach. Often notation like $\text{D}f$ is used where $f$ is a function. From this perspective, $(x^2)'$ is like $\text D(x\mapsto x^2)$. This makes $x$ a bound variable. We can't just replace it with a number. Naively done that would produce something like $\text D(1\mapsto 1^2)$ which is nonsense. We could interpret $(1^2)'$ as $\text D(x\mapsto 1^2)$ which would work fine and produce the constantly $0$ function as desired. Modulo some technicalities, this is closest to what's happening in the standard approach.
An alternative, more algebraic approach is to consider things like derivations. Here, instead of having functions, we have algebraic terms. $x$ ceases to be a variable and is instead a special constant for which we assert the equality $\text D x = 1$. In this case, it wouldn't make sense to naively replace $x$ with $3$, say, because that would be like saying "let $5$ be $7$." Alternatively, an interpretation that mapped $x$ to $3$ would likely be unsound. You could make a sound interpretation of $x$ as the identity function though and interpret the derivation operator as the $\text D$ operator from the first approach. Indeed, you could work with the algebraic notation but in terms of this particular interpretation of it. At any rate, this algebraic approach is very computational but not as flexible since you are limited to the terms of the algebra as opposed to being able to differentiate any (differentiable) function you can specify. On the other hand, this algebraic approach is applicable even in contexts where notions like limits don't make sense. This approach avoids having to deal with free/bound variables could likely be pretty jarring.
A kind of middle approach would be to restrict entirely to analytic functions and to work in terms of power series. If you want to go further, you could even identify power series with special (or, for formal power series, arbitrary) sequences of numbers. You could understand differentiating and integrating power series entirely as manipulations of sequences of numbers. More prosaically, you could work with the usual presentation of power series but emphasize manipulating coefficients. There's a lot of beautiful and useful power series manipulation calculations that could be introduced here that is useful for things like generating functions and Laplace/Z transforms.
There are other approaches as well, such as synthetic differential geometry or non-standard analysis. These also avoid some of the issues with bound variables, but introduce other issues and are less connected to standard practice in some ways. (Potentially, more connected to what mathematicians actually do in some ways.) I would say, more generally, that calculus is one of the first places in a typical (American, at least) math education that students have to start seriously grappling with notions of free and bound variables. Unfortunately, the notation of calculus makes this very confusing and opaque. I would recommend using notation that makes things more explicit (an extreme form is Structure and Interpretation of Classical Mechanics, but you don't need to go that far) and spend explicit time in the course teaching and practicing working with bound variables.
A: The domain of the derivative is functions, not numbers.  That's what at the bottom of this.
A: One way to do it is to say $f’(x)$=2x, and define $f(x)=x^2$. This way, it should be relatively clear that x is not some placeholder variable, but rather the independent variable in an equation. Additionally, if you introduce the Chain Rule, it should become even more clear. If students still try to use function composition without using the Chain Rule, switching to only using Leibniz notation for a while should quickly stifle that urge. You can then introduce prime notation again after the desire to directly compose in functions has been suppressed.
A: There is no one right answer to this question. It depends on what the students are willing to accept. One approach mentioned comes from the Wikipedia article on Dual numbers. The key idea is that
$\, f(x+\epsilon) = f(x)+f'(x)\,\epsilon\,$ where $\,\epsilon^2=0\,$ is postulated. Given this, then just use ordinary algebra $\,(x\!+\!\epsilon)^2 = (x\!+\!\epsilon)(x\!+\!\epsilon) = x^2\! +\! 2x\,\epsilon \!+\! \epsilon^2 = x^2\! +\! 2x\,\epsilon \, $ and therefore $\,(x^2)' = 2x.\,$ Notice that here you can do substitutions. For example,
$\, x \to 3+\epsilon,\,$ and then $\,x^2 \to (3+\epsilon)^2 = 9+6\,\epsilon,\,$ and thus $\, (9+6\,\epsilon)' = 6\,$ where we define $\, (a+b\,\epsilon)' := b.$
