Sorry, late to the party here: it’s not because of Irish or any Celtic language, but that’s in the ballpark of the correct explanation. “M” and “P” are homorganic consonants, which means that the steps to produce them are the same with one minor variation. Same was “B” & “W” (Bill / Will) etc. So if you’re going to vary the initial consonant but have a recognizable connection, your options are limited: “Margaret” > “Mag” / “Meg,” then you can only have “Bag / Beg,” with pre-existing negative meanigns, or “Nag / Neg,” or “Pag / Peg.”
For “Edward,” it’s the same—you add an “N,” which presumably is because of its position in the article “a(n)” and the way it comes and goes from words like “norange” and “napron” (Apron etymology in English | Etymologeek.com). Once you have “Ned,” your other options are “Ted,” “Med,” and “Ded.”
The same phenomenon is what drives mutations in the Celtic languages. “Peggy” in Welsh is “Begw,” again ultimately starting from a version of Margaret.
So: linguistic play, but with homorganic consonants to provide some intuitive rules for the otherwise crazy game.