The way a calculus course is usually built, before integrals you do Riemann sums and before that you do sums. I try to stress from the beginning in the sums that the running index is a "dummy variable" that disappears when you evaluate the sum. So
$\displaystyle \sum_{i=1}^n a_i = \text{some formula in } n, \text{but not in } i$
for example
$\displaystyle\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6} \text{ (-- the } i \text{ has vanished, what matters is the upper bound $n$)}$
And when one is at the integrals, completely similarly the $t$ under the integral is a dummy variable, so
$\displaystyle \int_{0}^{x} f(t) dt = \text{some formula in } x, \text{but not in } t$.
for example
$\displaystyle \int_{0}^{x} t^2 dt = \frac{1}{3}x^3 + C \text{ (-- the } t \text{ has vanished, what matters is the upper integral limit $x$)}$
So regarding your specific example, I would say writing $\int_0^x x^2dx$ is like writing $\sum_{i=1}^n n^2$. (I know in a specific sense it is not, actually; but I think this perspective can help students see the issue.)
integral(0, x, lambda x: x^2)
.) $\endgroup$