Work done to construct a uniformly charged ball I made some calculations and I got a correct answer, although I lack the intuition and I have no idea why it works.

Say we want to build a uniformly charged ball with radius $R$ and total charge $Q$, bringing charges from infinity and building it. In order to construct the shell, we need to do work against the force acting on every infinitesimal area element.

The electric field outside the shell is $E=\frac{kQ}{r^2}$ and inside is zero. Therefore, we get:
$$p=\frac{F}{A}=\frac{1}{2}\epsilon_0 (E_1-E_2)^2 = \frac{1}{2}\epsilon_0\left(\frac{k^2Q^2}{r^4}\right)$$
and integrating we get:
$$W=\int_R^\infty\int_0^{4\pi r^2}\frac{1}{2}\epsilon_0\left(\frac{k^2Q^2}{r^4}\right)\, dadr\, . $$
The result is the work done to construct only the shell. Now, what about the "inside" of the sphere? I did the same, but with $E=\frac{kQr}{R^2}$ and the radius ranging from zero to R and summed the two works (building the shell + building the inside) and I got the right result.
Now, my question is, why? For calculating the work done in order to build the inside of the sphere, I used the electric field inside a uniformly charged sphere, but what we actually do is build infinitely many shells, so I don't see how that works. I will be very glad for some clarification and intuition.
*I know there are easier ways to calculate it.
 A: If you're OK with Riemann sums as an intuition for the integral in general (say, integrating $y = x$ over $x$ from $0\rightarrow 1$), then the intuition behind the process of building a sphere with a bunch of infinitesimal shells should be surmountable. I don't think you're saying this is the problem, but I'm saying it anyway to keep the analogy alive between infinitesimal shells and infinitesimally width'd rectangles. Not to say this is the only intuition for integration ;)
It seems to me that you feel the weirdness is coming from the order in which the parts of the sphere are constructed, i.e., how could the inside of the sphere be created after the outside? How can I claim the outside has been constructed before constructing it!? To this, I'd say because the electrostatic field is defined as conservative (in the scope of electrostatics this is most simply seen with the ideas that (1) $\nabla \times \vec{E} = 0$ and (2) $\vec{E} = -\nabla V$), you can generate the parts of the sphere in any order and the answer would be correct.
I.e., the exact process taken to create the uniformly charged sphere doesn't matter.
In the same way that you add on at the end that you "know there are easier ways to calculate it", you are able to construct the sphere however you wish--so long as the final result is the same--the way to get to the result doesn't matter.
A: One can calculate the energy, or equivalently the work needed, either as an integration of the energy density or as an integration over the incremental work needed as one builds the charged sphere. One gets the same answer.
Firstly, as an integration of the energy density. Outside the sphere, the energy density of the electric field is $\rho(r)=\frac{1}{2} \epsilon_0 (k \frac{Q}{r^2})^2$, inside the sphere one has the energy density $\rho(r)=\frac{1}{2} \epsilon_0 (k \frac{Q r}{R^3})^2$. Through integration of $\rho(r)$ over the whole space one gets the total energy $\frac{3 Q^2}{20 \pi R \epsilon_0}$. (Note that $k=\frac{1}{4\pi \epsilon_0}$.)
Secondly one can show that the same amount of work energy is needed as one builds the charged sphere shell by shell.
If a sphere with radius $r$ is already built and one want to build the next shell to increase the sphere's radius to $r+dr$. The charge added is $dQ= 4 \pi r^2 dr Q /(\frac{4 \pi  R^3}{3})  $. The potential at radius $r$ at this time is $V(r)=\frac{k Q r^3}{r R^3}$.
So the work needed to add this infinitesimal shell is $V(r) dQ$. Integrating $r$ from $0$ to $R$ one get $\frac{3 Q^2}{20 \pi R \epsilon_0}$, same as the first method.
So both ways are correct. Using the integration over energy density is somewhat simpler, without needing to imaging how the charge were actually built.
