Suppose the function $$ f(x)=\begin{cases} 0, \text{ if }x<0,\\x, \text{ if }x>0.\end{cases}$$
Its derivative is $$ f'(x)=\begin{cases} 0, \text{ if }x<0,\\1, \text{ if }x>0,\end{cases}$$ and its second derivative is the $\delta$ function, $f''(x)=\delta(x)$. Fine.
Now suppose the function $$ g(x)=\begin{cases} 0, \text{ if }x<0,\\1+x, \text{ if }x>0.\end{cases}$$ The derivative $g'$ equals $f'$ almost everywhere. They are both undefined at $x=0$.
Question: is it true that $g''=\delta(x)$?
The derivatives $g'$ and $f'$ are distributions. As such, the "almost everywhere" that you are trying to use doesn't apply.
The equation that does hold is $g'=f'+\delta$.
Therefore $g''=\delta + \delta'$.