Suppose a function $y(t)$. Its total derivative is:
$$ d y(t)=y'(t)dt $$
Now I want to take the total derivative again:
$$ d(dy(t))=d(y'(t)dt)=(dy'(t))dt+y'(t)d(dt)=y''(t)dt+y'(t)d(dt) $$
What is $d(dt)$ - is it zero?
Suppose a function $y(t)$. Its total derivative is:
$$ d y(t)=y'(t)dt $$
Now I want to take the total derivative again:
$$ d(dy(t))=d(y'(t)dt)=(dy'(t))dt+y'(t)d(dt)=y''(t)dt+y'(t)d(dt) $$
What is $d(dt)$ - is it zero?
It depends on what notation you are using. Using standard notation, where the second derivative if $\frac{d^2y}{dt^2}$, this isn't actually possible. However, if you use a more flexible notation, $d(dt) = d^2t$. In this notation, the second derivative is
$$ \frac{d^2y}{dt^2} - \frac{dy}{dt}\frac{d^2t}{dt^2} $$
This notation allows for the algebraic manipulation of higher-order differentials, which the standard notation does not allow for.
Historically, many have considered $d(dt) = 0$ iff you believe $t$ to be moving at a constant rate. This is where the origin of the more simplified version of the second derivative came from. Basically, pre-relativity, we imagined time to be flowing constantly, so $dt$ was a constant, so its differential was zero.
However, if you are just dealing with equation manipulations like you are doing, then you need to use the expanded notation.
For more information, see my paper, "Extending the Algebraic Manipulability of Differentials".
You will understand an aswer if you understand for what argument do you want to take a derivative. Derivative depends on two numbers: $(d f)[x,t]=f'[x]t$. So \begin{equation}(d^2 f)[x,t]=d(f'[x]t)[x,t]=td(f'[x])[x,t]=tf''[x]t=f''[x]t^2,\end{equation} where in square brackets I wrote an argument of a function. Replacing $t$ with more convenient $dt$ you have that $(d^2 f)[x,dt]=f''[x](dt)^2$. The second derivative is a quadratic form by $dt$.