This event is lifted from the books. In the book, it’s done (or rather it’s strongly implied that it’s done) by Lord Manderly, who contrarily to his show alter-ego, is part of the North that remembers while pretending to be allied with the Lannisters/Boltons/Freys, and brings to a feast large quantities of food, including the Frey pies…hmmm…just added the spoiler for people who wants to read the book…let’s say it’s done by someone else (and I’m not really sure if lord Frey himself gets to taste the Frey pie) who is in a position to easily pull up this trick.
In the show, it stretches credibility that Arya could actually cook two Freys into a pie inside Frey’s castle, but since it’s obviously a wink to the readers who in general liked this event, I can accept to keep suspending my disbelief.