White has 9 units and Black has 15. White's only capture was exQd~ (doubled pawns). Black needs to uncapture all 7 missing White units with pawns, to restore the pawn structure and allow wP's to return home.
wPa and Ph must sacrifice themselves to Black pawns, and the only way to do it is to promote both pawns (no uncaptures possible on the a- or h- files). This means, before Black can retract axb and hxg, White pawns must un-promote and retract back far enough where they are not 'trapped' behind a black pawn once it un-captures.
Particularly difficult is the a-pawn promotion. The NW corner needs to be unlocked to solve the problem (after all, giving one or both Kings moves is the usual way to solve retros), but there is very limited space there. Nevertheless, with careful use of pawn tempos, there is just enough time and space to pull it off.
1...Bc1(+Qb2) 2.Ne2 Ra5 3.Nf4 Ra6 4.Ng6 Ra5 5.Nh8 Ra6 6.h7(-Nh8) Ra5 7.h6 Ra6 8.h5 Ra5 9.h4 g4h5(+Ng4)!
Why unpromote an N and then uncapture N?! The subtle motivation is to save Black a pawn tempo that he'll need later. If the original N charges into the NW corner, Black will have to spend both pawn tempos to let him in.
10.Nf2 Ra6 11.Nd3 Ra5 12.h3 Ra6 13.Nb4 Ra5 14.Na6 h6 15.Nc7 Ra6 16.Bb8 Ra8 17.Ba7 Rb8 18.Na6 Rb7 19.Nb4 Rc7 20.Bb8 Na7 21.Na6 Rc8 22.Nc7 Rg8 23.h2 Nc8 24.Ba7 Rg3 25.Bb8 Rd3 26.Ba7 Rc3 27.Bb8 Rc2 28.Qc3 Rb2 29.Qa5 Na7 30.Qa6 Nc8 31.Qb7 Na7 32.Qa8 Nc8 33.a7(-Qa8)
Only now can we see why White's initial moves were so important: Black would be stuck here, if the h-pawn was already on h7.
33...h7 34.a6 Na7 35.a5 b5a6(+Rb5) etc.