how does recovering a plane from stall lead to exceeding the critical mach speed?
There are two types of stall: One is when speed drops below minimum speed, the lift curve slope flattens or inverses, flow separates and lift drops below weight. This is explained here.

The second type is a high speed stall and is caused by shock-induced flow separation when the aircraft approaches Mach 1. In this case, the aircraft will accelerate to a higher flight Mach number where its maximum lift coefficient is smaller and causes lift to drop below weight. Here stall is caused by a speed increase, hence the name.



Lift coefficient variation over Mach number (picture source)

In the coffin corner, the highest point in the envelope of subsonic high performance aircraft, both speeds coincide. Now the aircraft can fly only at one speed, both a speed decrease and a speed increase will cause stall. When the plane recovers from a low speed stall while flying near the coffin corner, it needs to speed up and consequently runs the risk of accelerating beyond the critical Mach speed at which the lift coefficient drops and causes a high speed stall. Recovery is only possible by sinking into higher density and warmer air where the difference between both stall speeds widens and more lift can be created.

Generally, this happens to jets with straight or moderately swept wings which are powerful enough to fly high and fast but are not designed to exceed Mach 1. The Lockheed U-2 would be a prime example.