OK, we have to make a step back. Your "Consider a sphere of radius r passing through the point p. Let the electric field at p be E then by Gauss law " continues with a picture with formulas that seem to be out of context: at P there is no charge, so div E is zero there !
Where does this snippet come from? It also integrates from ## r=-\infty## to ## r=\infty## which is very weird, since r can't be negative. Then it equates that to ##2\int_0^\infty\ ##, then inserts a ##- {1\over 3 }## from nowhere (re-check the power rule)!
So, stepping back and trying to find the correct path:
Gauss law replaces a surface integral of E by a volume integral of rho. Indeed ##\nabla \vec E = {\rho\over \epsilon_0} ##, but ## \rho \ne q\big /{4\over 3}\pi r^3\ ## ! That is ##\rho## for a uniformly charged sphere with radius r !
In this simple case the volume integral of rho simply yields q. Frome there use rotation symmetry and gauss law to get to E.
Another thing: note that div E is not ## dE\over dr## !
Divergence in spherical coordinates tells us that
for rotational symmetry ##\nabla\cdot\vec E = {1\over r^2}\; {\partial (r^2E_r)\over \partial r}##
(
as you can check: div E = 0 for the desired result for E
and conversely: with rotational symmetry, Er2 is constant outside the area where charge is present.
).
[edit] forgot the divergence link, inserted it.