The muggins claim by Player 1 cannot be made until the peg is moved by Player 2 and released - which in this case wins the game.
Even if this is not a written official rule, it is the only sane way to play muggins. There must needs be an official start to the muggins claiming period, which definitively indicates that Player 1 is satisfied with his hand count. Moving the peg and releasing it is exactly that.
Here is the official American Cribbage Congress Rules of Muggins. It specifically states (my emphasis):
Rule 10.2. Situations That Apply
Except for the situations listed in rule 10.3, muggins is applied to the underpegging of the full value of any points during the play or scoring of the points in the hand or crib.
and further down
c. For points missed in a hand or crib:
(1) The dealer must call muggins after the pone has finished pegging the score or states there is no score and before the pone's hand is mixed with other cards or the total count of the dealer's hand is announced.