Without going into the details of the underlying equations of motion, I could argue that the D part is needed to damp out the oscillations of the pole while reaching for the (unstable) equilibrium point with no overshoots and guaranteeing at the same time sufficient dynamics.
Now, if we consider the context where the equilibrium point is reached but the cart is still accelerating, the only term capable of counteracting the inertial forces on the pole is the integral I, which indeed is the only part delivering effort when we have 0 error. Besides this, the integral is always desirable to compensate for uncertainties in the plant.
To elaborate more, I've found this quite enlighting reference on the dynamics of the cart-pole system.
Essentially, if we linearize the system we get:
$$
\ddot{\theta}=\frac{g}{L}\theta+\frac{u}{ML},
$$
where $\theta$ is the angular displacement of the pole with respect to the equilibrium, $u$ is the force applied to the cart, $M$ is the mass of the cart, $L$ is the length of the pole, and $g$ the gravity acceleration.
Contrary to what I said above, for $\theta=0$ we can obtain the equilibrium $\ddot{\theta}=0$ with $u=0$, thus the integral I is not strictly required. Anyway, we ought to recap that ours is only an approximated linear model; therefore, the I term can help compensate for the unmodeled quantities.
Let's come to the PD part then.
The system is unstable because of the positive eigenvalue $+\sqrt{g/L}$. Hence, we need to find a suitable control law to stabilize it. A full state-feedback controller is proposed in the reference, which is of the form:
$$
u=h_1\theta+h_2\dot{\theta}.
$$
It's easy to demonstrate that for $h_1=-Mg$ and $h_2<0$, the resulting closed-loop eigenvalues are both stable $\lambda_{1,2}=0,h_2/ML$.
To conclude, $u=-Mg\theta+h_2\dot{\theta}$ is nothing but a PD. Actually, this is more properly called a state-feedback controller, but we can clearly see the contributions of the proportional and the derivative parts, although not specified in terms of the error.
Now, let's go back to the I part.
If we don't know precisely the value of the mass $M$ and also we measure $\theta$ with a certain level of accuracy, then $h_1\theta=-Mg\theta$ won't cancel out exactly the term $\left(g/L\right)\theta$ in the dynamics equation. The mismatch between the designed and the real parameters can be tackled by using the integral part I.