You are correct that Maple does not understand your commands as you intend them, but I suspect not for the reasons you think. I don't think there is a way to fix this, unless Maple supports Stieltjes integration, or has a built-in to calculate total variation.
Your definition of total variation is correct in a distributional sense. What does that mean?
For each integrable $ f \in \mathbb{R}\to\mathbb{R} $, we can define $ f^* \in C_0(\mathbb{R}\to\mathbb{R})\to\mathbb{R} $, a continuous linear functional defined on the set of all continuous functions vanishing at infinity, as follows: $$ f^*(g) = \int_{\mathbb{R}}{f(x)g(x)\,dx} $$ If $ f $ is differentiable, we have the useful relation that, for functions $ g $ vanishing sufficiently rapidly at infinity $$ \int_{\mathbb{R}}{-f(x)g'(x)\,dx} = (-f(x)g(x))|_{x\to-\infty}^{\infty} - \int_{\mathbb{R}}{-f'(x)g(x)\,dx} = 0 + \int_{\mathbb{R}}{f'(x)g(x)\,dx} $$ In other words, the functional $ T : L^1(\mathbb{R}\to\mathbb{R})\to C_0(\mathbb{R}\to\mathbb{R})\to\mathbb{R}$; $$ T(f)(g) = \int_{\mathbb{R}}{-f(x)g'(x)\,dx} $$ satisfies $ T(f) = f'^* $ whenever the right hand side is well-defined. It seems reasonable to say even when the RHS is not well-defined, $ T(f) $ represents some sort of generalized derivative of $ f $. Using this $ T $ to extend the derivative is traditionally called working "in a distributional sense."
It seems (from a cursory internet search) that Maple has only limited support for distributions (namely, the only feature is Dirac's delta as a built-in). So Maple is likely defining the derivative of your $f$ as follows: $$ f'(x) = \begin{cases}
0 & x < 0\text{ or }1not defined at 0 and 1, and integrates to 2.
We might do better and say $$ f'(x) = \begin{cases}
0 & x < 0\text{ or }1integrals don't care about single points. Your function is complicated, so let's take a simple example, and apply the Riemann Integral (what I'm saying also applies if you know the Lebesgue Integral—one-point sets are Lebesgue-Null). Let $ g_a : L^1(\mathbb{R}\to\mathbb{R}) $; $$ g_a(x) = \begin{cases}
0 & x \neq 0 \\
a & x = 0
\end{cases} $$ Then $$ \int_{-1}^1{g_a(x)\,dx} = \lim_{P \to [0,1]}{\sum_{z\in[x,y]\in P}{g_a(z)(y-x)}} $$ where P is in the directed set of partitions under inclusion. Since g vanishes away from the origin, we can drop the terms corresponding to intervals that do not include 0; then $$ \left|\int_{-1}^1{g_a(x)\,dx}\right| = \lim_{\max{(-x,y)}\to0}{|g_a(z)(y-x)|} \leq \lim_{\max{(-x,y)}\to0}{|a|(y-x)} = 0 $$ as $ |g_a|\leq|a| $ everywhere. So $\int_{-1}^1{g_a(x)\,dx}=0$. Worse, even when we take an infinite discontinuity, we still have a null integral. $ g_a \to g_{\infty} $ uniformly as $ a \to \infty $, so $$ \int_{-1}^1{g_{\infty}(x)\,dx} = \int_{-1}^1{\lim_{a\to\infty}{g_a(x)}\,dx} = \lim_{a\to\infty}{\int_{-1}^1{g_a(x)\,dx}} = \lim_{a\to\infty}{0} = 0 $$
Any one-point discontinuity can be represented as the sum of $ g_k $ and a continuous function. The first integrates to 0, so the discontinuity may be dropped. Maple is ignoring the infinities that pop up in your derivative and just integrating over them to 0.