No, this mere substitution argument cannot work, and you haven't made an algebraic mistake at all. This goes precisely to show you that these differentials are NOT real numbers. So, there is absolutely no reason you should treat them as real numbers and perform the usual arithmetic of real numbers with them. Therefore, the better question to ask yourself is why would you even expect this naive "substitution" to work? Sure, in single variable calculus, many such arguments just happen to "work", but of course this is not at all a good reason to expect it to keep working.
So, how do we treat such integrals? The key result is the multi-dimensional change of variables formula. The proof of this formula is very technical, and not easy at all, but the rough idea is I think straight forward. A very rough way of saying it is that in cartesian coordinates, the function you're integrating is , so when you change to polar coordinates, you have modified your function to
If we modify the function, then of course we have to modify how we measure the areas. Now, in cartesian coordinates, a little area element is described as dx dy, which you intuitively think of as a small box of size dx and dy. But if you now want to integrate in polar coordinates, you have to think of what does a little area element look like. There are several geometrical justifications available for this on this site and others, and the correct answer is . That factor of r encodes how the area changes as you measure things in cartesian coordinates vs how you measure things in polar coordinates.
Once again, there is absolutely no reason to think the correct area element should be obtained by plugging in … and likewise for dy, into the "product" (however it is defined) dx dy. Nor should you expect that "because in cartesian coordinates, therefore in polar coordinates". None of these is a proper way of determining the area element in a different coordinate system. It's not only wrong, but there's also no reason to expect it to work.
In general, the correct scale factor which accounts for the difference in area measurements in different coordinates is the absolute value of the determinant of the derivative of the coordinate transformation. This is a non-trivial issue, and there are several answers on this site which explain in more detail why this is the right "conversion factor" (and also entire chapters of textbooks devoted to this formula and its geometric significance).
Hopefully now that you're convinced that naive substitution is not at all even a reasonable thing to do, let's see how one can arrive at the answer mechanically. It's very simple, and even very memorable:
Where that funny derivative is a matrix of partial derivatives, which in this case is:
The absolute value of the determinant is |r|, but this is simply r, since . Therefore, .
Another way to approach the subject is by the means of differential forms. The differential forms machinery pretty much encodes in its definition the determinant of the Jacobian matrix. Now, I won't detail the entire theory of differential forms, but here's the "rules" (again if you want to know more, there's entire books on the subject).
Here, things like etc are no longer real numbers/infinitesimally small but non-zero numbers (whatever that is supposed to mean in typical analysis). What are they? They're the section of the cotangent bundle. Ok, that's probably just some mumbo jumbo right now, but here's how we calculate with them.
For the purposes of integration, we no longer write dxdy. Instead, we put a little , like dxdy; this is called the wedge product. The key property it has is that ; so it alternates sign whenever you flip two of them. In particular, (I flipped them) and therefore . In other words whenever you wedge the same thing, it vanishes. Finally, all the other rules, like associativity, distributivity "expanding brackets" etc all work as normal. Now we can compute:
It is a general fact that the factor you get in front will always be the determinant of the Jacobian matrix of the coordinate change. The main reason for this is that there is a deep connection between determinants, alternating objects like differential forms, and volumes of parallelepiped (which you may have learnt in linear algebra).
These relations are very general, and work for any coordinate system. For exmaple, if you consider parabolic coordinates , whose relation to cartesian coordinates is and , you can work through a similar mechanical procedure to find
Final Remarks.
There are several subtleties which I have had to gloss over, like the concept of orientation, why differential forms are "suitable objects to integrate", etc. But hopefully this gives you an idea for why naive substitution doesn't (and shouldn't be expected to) work, and that one needs an appropriate scale factor to treat the areas; also hopefully there have been enough "mechanical" rules to help (of course you should eventually try to understand them at a deeper level).
One more thing I'd like to highlight is that while the differential forms approach gives a very quick and easy mechanical approach to the change of volume factor, and while computing determinants algebraically is very straight forward, it is very important to keep in mind the geometry behind these formulas. These Riemann integrals are all about areas of various (simple) figures, so it is absolutely essential to atleast somewhat connect the algebraic significance of the determinant to its geometric significance regarding areas/volumes.