Both the dough and filling can be made ahead of time for this dish packed full of greens. It’s great served at room temperature with a summer tomato salad.
Combine the flour, sugar and 1 teaspoon salt in a food processor and pulse until mixed. Add about a third of the butter and process until thoroughly combined with no visible chunks of butter (the mixture will be slightly yellow). Add the remaining butter and pulse until the mixture resembles a very coarse meal with pea-size bits of butter. Add the vinegar in a single pulse. Gradually add 1/4 cup ice water through the feed tube, pulsing just until evenly combined. Squeeze a handful of the dough together-it should just hold its shape and be a little crumbly. If still very powdery, pulse again, adding up to 2 tablespoons ice water.
Turn the dough out onto a work surface. Pat about two thirds of the dough into a square about 1/2-inch thick. Repeat with the remaining third of dough. Wrap each piece tightly in plastic wrap and refrigerate until firm, at least 1 hour or up to 2 days.
Nest a colander in a bowl. Heat 2 tablespoons olive oil in a large high-sided pan over medium-high heat. Add the onions, chard stems, 1 1/2 teaspoons salt and a few grinds of pepper and cook, stirring occasionally, until the onion is translucent and starting to brown, 8 minutes. Stir in the garlic and cook for an additional minute. Transfer to the colander.
Drizzle another tablespoon of olive oil in the pan; add half the chard leaves and a sprinkle of salt. Stir until the leaves are wilted and cooked, about 2 minutes. Transfer to the colander. Repeat with the remaining oil and chard leaves. Press the cooked chard with the back of a large spoon or dry measuring cup to squeeze out as much excess liquid as possible. Let cool completely.
Whisk together the ricotta, 1/2 cup Parmesan, 1 egg, 1 teaspoon salt and 1/2 teaspoon pepper in a large bowl.
To assemble the pie: Adjust an oven rack to the bottom position and preheat the oven to 400ºF. Butter an 8-inch-square baking dish and lightly beat the remaining egg in a small bowl.
Let the dough pieces stand at room temperature for a few minutes until slightly softened to make rolling easier. Place the larger piece of dough between two large pieces of floured parchment and roll into a rough 14-inch square, 1/8-inch thick (if the dough gets too soft, pop it in the fridge to firm up, then continue rolling). Roll the smaller piece into a rough 11-inch square in the same manner.
Transfer the larger piece of dough to the prepared baking dish. Gently press the dough into the bottom and up the sides of the dish, leaving some overhang. Brush the bottom and sides with some of the egg wash. Sprinkle the bottom with breadcrumbs and the remaining 2 tablespoons Parmesan. Add the cooled chard and pat down gently. Spread the ricotta mixture evenly on top.
Put the remaining dough over the filling, lining up the edges with the bottom piece of dough as best you can. Pinch the edges together, trim any excess, then fold and crimp the edges to form a tight seal. Brush the top and edges of the crust with the egg wash and cut decorative slits in the top of the pie. Sprinkle with sesame seeds, if using.
Bake until the crust is deep golden brown, about 1 hour. (If the crust browns too quickly, cover the pie loosely with foil.) Let cool at least 1 hour before serving.