White's f3, g3, and h6 pawns started among f2, g2, and h2, so White's h7 pawn started on c2, capturing 5 black pieces on the d3-h7 diagonal. White's c3 pawn started on b2 and captured 1 black piece. That leaves only 1 black piece for capture, so White's f-, g-, and h-pawns did not switch files or make any captures.
If Black's g6 pawn had started on h7, it would always block White's h7 pawn, so it started on g7. To pass White's h6 pawn, Black's h5 pawn started on h7 and captured 2 white pieces on g6 and h5.
By the time Black's dark-squared bishop (DSB) could move, Black's g6 pawn, h5 pawn, and king could no longer move, and White's h7 pawn had captured 5 black pieces, so Black's only remaining moves used its DSB, c2 pawn, h2 pawn, or last remaining piece.
Black's h2 pawn started on c7, capturing 5 white pieces on the d6-h2 diagonal, so Black's c2 pawn started on b7, capturing at least 1 white piece. Black's h2 and h5 pawns captured 7 out of 8 white pieces in total, so Black's c2 pawn captured exactly 1 white piece, which was somewhere on the c-file.
Before White's a-pawn could be captured, it captured a black piece to pass Black's a7 pawn and promote. Before White's DSB could move to be captured, White played bxc3. Either White's a- or b-pawn captured Black's DSB, so Black captured either White's a-pawn or DSB after freeing its own DSB. In particular, gxh5, which eventually freed Black's DSB, was not Black's last capture.
Before White's light-squared bishop (LSB) could move to be captured, White played g2, so gxh2 was also not Black's last capture.
Therefore, black's last capture used its b-pawn. This happened after White used its a- or b-pawn to capture Black's last piece, so Black's last move used its b-pawn. White's last move was not bxc3, so Black's last move was bxc2.
Suppose bxc2 captured White's promoted a-pawn.
Black's h2 pawn only captured dark-squared pieces, so Black's h5 pawn captured White's LSB. Before this, Black played gxh2 to free White's LSB for capture by Black's h5 pawn. Before that, White played bxc3 to free White's DSB for capture by Black's h2 pawn. At that point, Black's DSB was still trapped by Black's h5 pawn. Therefore, White's a-pawn captured Black's DSB as its last capture, after which Black's only remaining moves used its b-pawn. However, Black would have run out of tempi before White's a-pawn could promote and move to c2.
Therefore, bxc2 did not capture White's promoted a-pawn, so it captured White's LSB.
Before Black's DSB was freed, Black played g6 and White played gxh7, so White's last capture did not use its h7 pawn, and after White's last capture Black only moved its c2 and h2 pawns.
Between when Black played gxh2 and bxc2, White needed to play at least 4 moves to allow Black's b-pawn to capture its LSB (e.g., g3, Bh3, Bf5, and Bc2), so Black needed to play at least 3 moves using its b-pawn, including b5, b4, and b3. When Black played gxh2, White's a-pawn had already promoted, so Black's b-pawn was on b6 instead of b7. Therefore, Black had no extra tempi, so White played exactly those 4 moves during that time. Furthermore, between White's last capture and gxh2, Black only played moves using its h2 pawn.
Suppose White's a-pawn made its last capture. The situation is represented in the following diagram, where White's king and f3 pawn have been removed because their locations are unknown.
White lacks the tempi to promote and move its a-pawn to one of the circled squares before Black's d6 pawn reaches it, so White's a-pawn did not make its last capture.
Therefore, White's last capture was bxc3. The situation is represented in the following diagram, where again White's king and f3 pawn have been removed because their locations are unknown.
The only way for White to move its DSB to one of the circled squares before Black's d6 pawn reaches it is by playing Ba3, Bc5, Bg1, and Bh2.
All of this forces the game to end with exactly the following sequence of moves:
- bxc3 cxd6
- Ba3 dxe5
- Bc5 exf4
- Bg1 fxg3
- Bh2 gxh2
- g3 b5
- Bh3 b4
- Bf5 b3
- Bc2 bxc2
Because it would otherwise be attacked by Black's e5 pawn, White's king made the last move. It could have moved from neither c4/c5 because of Black's b-pawn, nor e3/e5 because of Black's e5/f4 pawn, nor d3/e4 because of Black's LSB, so the last move was
Kd5-d4.
Here's an example of a game that achieves the final position: https://lichess.org/mlJREDXu.