Rook pie is still a dish found in Britain today, ith fledgling rooks being shot by farmers to cut down on the amount of grain lost to the birds, and as magpies, like rooks, are members of the Corvidiae, and magpies used to be killed in great numbers because of their (alleged) habit of eating game bird eggs and game bird chicks, it seems feasible dead magpies ended up, like rooks, baked in pastry, and subsequently gave their name to pies-the-food generally.
Then again, the other route to “pie” from “magpie”, as suggested in the extract from the OED quoted by Aldi, through the bird’s habit of gathering a “collection of miscellaneous articles”, with a culinary pie being a similar mixture of different things*, is echoed in the expression “printer’s pie”, “A mass of type in confusion or mingled indiscriminately,” (OED) that is, for example, what you get when you accidentally drop a made-up form of type on the floor.
There is, of course, another link between magpies and printers: the Latin name for the bird, as Jheem mentions, is “pica”, and “pica”, pronounced “pai-kah”, is the name long given to 12-point type, while the “pica em”, the dimensions of the face of a piece of pica-sized type containing the letter “m” (12pt by 12pt, or just about one sixth of an inch square) was the standard typesetting measurement (shortened to “a pica” in the US and “an em” in the UK, don’t ask me why – I still have my “em rule”, marked off in units of 12pt, though computerised page layout has made it obsolete).
The usual suggestion for the derivation of the name “pica” for 12pt type is that it was the size of type used for printing a “pie” or “pye”, a book of rules for determining the Church office of the day, called a “pica” in Late Latin, “possibly the same as L. pica, magpie, from the black and white appearance of the page” (Chambers 20th Century Dictionary), although as the OED says under “pica, n2”, the problem with that theory is that “ no edition of the ecclesiastical directory in ‘pica’ type appears to be known”.
Then there’s “pica, n1 … craving of pregnant women for strange food (on account of the magpie’s feeding on miscellaneous foodstuffs)” (OED) … I wonder if anyone suffering from pica has ever had an uncontrollable desire to eat pies?
*The version with only one main ingredient, at least in the Middle Ages, being properly designated a “pasty”, according to John Ayto’s Bloomsbury Dictionary of Word origins, but my experience of modern pasties is that they contain as many or more ingredients as pies …