To really see it you will need to do a small-signal analysis. But the short answer is that cascoding depends on the fact that in a transistor, the output current depends MOSTLY on the VBE but a little on the VCE.
If the transistor were ideal, and VA (the Early voltage) were infinite, then you wouldn't need cascoding since a simple current mirror would have infinite output resistance.
But, in the real world, the transistor has finite output resistance and in a simple current mirror (in your case Q1 and Q2) the output resistance of the current mirror is the same as the output of the transistor. We need to do better.
The way a cascode works is to keep the collector voltage of Q2 constant to first order (the extent it can do this depends on the gm of Q4). By isolating the output of the mirror from the collector of Q2 we greatly increase the output resistance (remember output resistance is Vo/Io).
Again, to really own this concept, you gotta go through the calculations yourself. It is highly instructive.