Let $y = f(x)$.
$$f'' = \frac{d^2y}{dx^2}$$
The explanation for this being that
$$ \Bigl(\dfrac{d}{dx}\Bigr)^2 y = \dfrac{d^2}{dx^2}\,y = \dfrac{d^2 y}{dx^2};$$
Since there are two $d$'s in the bottom of the fraction, why is it not written
$$\frac{d^2y}{d^2x^2}$$
Maybe it's because $dx$ needs to be thought of as a single thing. But notice that $d$ is used by itself and squared in the numerator..
Does my point here make sense, is it just a convenience to avoid the extra exponent, or is there a logical reason it's written in the form it is?
Its customary to write $dx^2$ to denote $(dx)^2$ in all common theories of calculus, then we set
$$ \frac{d}{d x}\circ \frac{d}{d x}=:\left(\frac{d}{d x}\right)^2=:\frac{d^2}{dx^2} $$
The last expression is a whole, that is, $d^2$ and $dx^2$ doesn't make sense by themselves (and the fraction is just a notation resembling the analytic definition of the derivative but it doesn't mean something). The second expression $\left(\frac{d}{d x}\right)^2$ is common for any linear operator to represent the composition of a linear operator with itself, and $\frac{d}{d x}$ is a linear operator in the space of real-to-real smooth functions.