I think this is much more than a "guess". The only "unknown" part to the equation is why it was "P" that became the sound chosen to form the rhyming form. But it is quite clear how
Margaret leads to Marg which leads to Mag which leads to
Meg. And the final step to
Peg -- well, we know that it was quite common to create rhyming forms of nicknames of other common given names in medieval times, such as Hick and
Dick from
Richard.
Both
Peggy and
Polly have been in use since the early 1200s. And we also have
Patty, in use as a pet form of
Martha since the late 1600s at least. So it just became the custom for common female names starting with M to develop rhyming forms with P.