For higher-order differentials to work algebraically, you need to adopt a notation that is a little non-standard. The typical notation, $\frac{d^2y}{dx^2}$ does not allow for algebraic manipulations.
However, if you take the first derivative, $\frac{dy}{dx}$ and take the derivative of it, you will notice that it is indeed a quotient, and therefore needs to use the quotient rule. The result will be that the notation for the second derivative is $\frac{d^2y}{dx^2} - \frac{dy}{dx}\frac{d^2x}{dx^2}$. This is fully algebraically manipulable. For instance, by straightforward algebraic notations, you can establish an inverse function theorem for the second derivative. Because the second derivative of $x$ with respect to $y$ is (using this notation) $\frac{d^2x}{dy^2} - \frac{dx}{dy}\frac{d^2y}{dy^2}$, we can see how to get there as follows:
$$
y'' = \frac{d^2y}{dx^2} - \frac{dy}{dx}\frac{d^2x}{dx^2} \\
y''\, dx^3 = d^2y\,dx - dy\,d^2x \\
y''\, \frac{dx^3}{dy^3} = \frac{d^2y}{dy^2}\frac{dx}{dy} - \frac{d^2x}{dy^2} \\
-y''\,\frac{dx^3}{dy^3} = \frac{d^2x}{dy^2} - \frac{d^2y}{dy^2}\frac{dx}{dy} \\
-y'' \frac{1}{y'}^3 = x''
$$
This is more fully fleshed out in two papers I was involved in, "Extending the Algebraic Manipulability of Differentials" and "Total and Partial Differentials as Algebraically Manipulable Entities". But, in short, there is no problem in manipulating differentials algebraically as long as you use the proper notation, with notation being especially important for higher-order differentials and partial differentials. Most of the theoretical objections have come from general objections to infinitesimals, but the hyperreal number system has demonstrated that there is no logical problem with such numbers.
To address your specific example, though, the problem is that you are treating $d$ by itself as an entity. It is not. It is an operator. $dx$ is actually $d(x)$. You can think about it kind of like a function, such as $\sin(x)$, at least when considering parenthesis movement. The problem in your example is that you haven't properly parenthesized it. I will expand parentheses here so it is easy to spot the problem:
$$\frac{dy'}{dy} = \frac{d(y')}{d(y)} = \frac{d\left(\frac{d(y)}{d(x)}\right)}{d(y)}$$
As you can see, you can't get the $dy$s to cancel out because one is inside the other differential. Now, we can compute the differential, which yields:
$$\frac{\frac{d^2y}{dx} - dy \frac{d^2x}{dx^2}}{dy} = \frac{d^2y}{dx\,dy} - \frac{d^2x}{dx^2}$$
So, as you can see, you can do manipulation, it's just that you have to keep in mind the type of operations you are actually doing and what they are being applied to. Similar to functions, you can't just willy-nilly move the argument of an operator inside or outside the operator without justification.
Edit: OP asked for elaboration on the chain rule for the second derivate
For the chain rule for the second derivative, the chain rule still "works" but it is not necessary. In other words, the chain rule simply tells you which algebraic manipulations will bring you from one derivative to another.
So, let's look at what the chain rule is (we will use Arbogast/Euler D-notation to avoid confusion):
$$ D^2_t(y) = D^2_x(y)\,(D^1_t(x))^2 + D^1_x(y)\,D^2_t(x) $$
So, the left side is $\frac{d^2y}{dt^2} - \frac{dy}{dt}\frac{d^2t}{dt^2}$. So, let's just do the algebra of the right-hand side and see what happens. I'll over-parenthesize so you can more easily see the components.
$$
\left(\frac{d^2y}{dx^2} - \frac{dy}{dx}\frac{d^2x}{dx^2}\right)\, \left(\frac{dx}{dt}\right)^2 + \left(\frac{dy}{dx}\right)\,\left(\frac{d^2x}{dt^2} - \frac{dx}{dt}\frac{d^2t}{dt^2}\right) \\
= \left(\frac{d^2y}{dx^2} - \frac{dy}{dx}\frac{d^2x}{dx^2}\right)\, \left(\frac{dx^2}{dt^2}\right) + \left(\frac{dy}{dx}\right)\,\left(\frac{d^2x}{dt^2} - \frac{dx}{dt}\frac{d^2t}{dt^2}\right) \\
= \left(\frac{d^2y}{dt^2} - \frac{dy}{dx}\frac{d^2x}{dt^2}\right) + \left(\frac{dy}{dx}\frac{d^2x}{dt^2} - \frac{dy}{dt}\frac{d^2t}{dt^2}\right) \\
= \frac{d^2y}{dt^2} + \left(-\frac{dy}{dx}\frac{d^2x}{dt^2} + \frac{dy}{dx}\frac{d^2x}{dt^2}\right) - \frac{dy}{dt}\frac{d^2t}{dt^2} \\
= \frac{d^2y}{dt^2} - \frac{dy}{dt}\frac{d^2t}{dt^2}
$$
So, you can see, the chain rule for the second derivative simply encodes the steps we would need to algebraically manipulate one derivative into the other.