Calculation of Moment of inertia by exploiting the fact that it only depends upon the distribution of mass with respect to the principal axis First of all what do I even mean when I say  ‘the method of exploitation of the fact that only mass distribution is what matters with respect to the principal axis(I will be referring this method as exploitation method for the post)’. let me illustrate this by describing the method and then afterwards by an example.
The Reason why Exploitation method works
I believe that the exploitation method is a very powerful method. Through this method moment of inertia can be calculated for the objects in reference to objects that have same mass distribution as them. Let me prove this method by stating a few points:-

*

*Moment of inertia calculation of a continuous object is simply the addition of the particles making it up at various distances from the principal axis.


*The only way to change $\mathrm{I}$ of these particles is by changing either the mass or the distance from the principal axis. It must mean that in the given below figure all have same moment of inertia. (source)



*Now consider a system of particles in 2 cases and note that in both the cases, moment of inertia will also be same.(source:MSPaint)

The case of a hollow cone
Here Consider a cone of height $\mathrm{H}$ and radius $\mathrm{R}$ now to find the moment of inertia of this hollow cone. Now to calculate the moment of inertia of this one may use integration by taking a ring of mass $\mathrm{dm}$ but I know of the above technique that if this cone is put under a hydraulic press then finally we would be getting a disc of same mass and radius. This may be more imaginable if we consider many elementary rings making up the cone. But the mass distribution would be same thus the moment of inertia of both objects will be equal as shown below:-
The Question Is about a sphere
It can be seen that this method won’t work here as imagining the similar approach. We can divide the sphere into two hemispheres and consider similar approach as above as in putting under a hydraulic press. Through that, we would be getting a disc but we know that, $$\mathrm{I_{disc} \neq I_{Hemisphere}}$$
Therefore, my question is as follows;

Why does this method not work for hemisphere? And for what general cases is this method not valid?

 A: A disk of constant density will not be the same as a "squashing" a hemispehere of constant density because the resulting density will not be constant with radius.  So the mass distribution is different.
A: In the comments, @Buraian almost has it right. The key thing is not that $\frac{dr}{dh}$ is constant, but rather that the ratio of area elements is constant:
\begin{align}
dA_{\text{cone}}&=\frac{L}{R}\,dA_{\text{disc}}
\end{align}
where $L=\sqrt{H^2+R^2}$ is the slant height of the cone. In this case, the constancy of $\frac{dr}{dh}$, and the rotational symmetry of the cone/circle  imply the above constancy of the ratio of the area elements, which is why everything works out nicely for the cone example.
Let us actually be more explicit about where exactly this constancy is invoked. Let $\sigma_0$ be the constant surface mass density on the cone, and let $r$ be the coordinate describing the distance to the $z$-axis. The way to calculate the moment of inertia is
\begin{align}
I_{\text{cone}}&:=\int_{\text{cone}}r^2\,dm_{\text{cone}}\\
&=\int_{\text{cone}}r^2\sigma_0\,dA_{\text{cone}}\\
&=\int_{\text{disc}}r^2\sigma_0\,\frac{L}{R}\,dA_{\text{disc}}\tag{$1$}\\
&\equiv\int_{\text{disc}}r^2\,\rho_0\,dA_{\text{disc}}\tag{$*$}\\
&=I_{\text{disc}}
\end{align}
where $(1)$ uses the change of variables formula to convert the integration form the cone to the disc (I'm using the "vertical map" corresponding to your "hydraulic press" analogy, i.e take a point $(x,y,z)$ on the surface of the cone and project it down to $(x,y)$ in the disc). In formula $(*)$, I have defined a new quantity $\rho_0:=\sigma_0\frac{L}{R}$. This is to be interpreted as the mass density of the disc after you "vertically compress" the cone. Because $\sigma_0$ was constant and because the area elements are proportional by a constant, it follows that $\rho_0$ is also a constant. This is why you're able to unambiguously refer to $M$ as the total mass of either the cone/disc and in the very last equality, you can use the formula for the moment of inertia of a disc (with uniform density) to conclude that $I_{\text{cone}}=I_{\text{disc}}=\frac{MR^2}{2}$.
One thing to note above is that while the total mass remains constant, the density changes (it changes from the constant value $\sigma_0$ on the cone to the constant value $\rho_0$ on the disc). In the case of a sphere, things are worse. It is no longer true that the areas scale in a constant fashion. In fact (for a unit hemisphere and disc),
\begin{align}
dA_{\text{hemisphere}}&=\frac{1}{\sqrt{1-x^2-y^2}}\,dA_{\text{disc}}
\end{align}
This is why your approach fails for the disc (even if $\sigma_0$ started out constant, you'd end up with $\rho(x,y)=\sigma_0\cdot \frac{1}{\sqrt{1-x^2-y^2}}$ which is non-constant hence the integral must be evaluated directly). You must actually start with a mass density like $\sigma(x,y,z)=cz$ for some constant $c$ in order to "cancel out" the geometric effect of how the areas transform so that in the end you get a constant $\rho_0$.
