Make the Pierogi Dough: Pulse the flour and salt together in a food processor until combined, about 4 pulses. With the machine running, slowly add the whole egg, egg yolk, and oil through the feed tube until the mixture resembles wet sand, about 30 seconds. With the machine running, slowly add 4 tablespoons of the water until the dough forms a ball. If the dough doesn’t ball up, add the remaining water, 1 tablespoon at a time, with the processor running until a dough ball forms (you may not use all the water).
Transfer the dough to a lightly floured work surface and knead by hand until it firms slightly and becomes smooth, about 2 minutes. Cover with plastic wrap and set aside to relax for at least 15 minutes or up to 2 hours.
Make the Caramelized Onions: Meanwhile, melt the butter in a 12-inch nonstick skillet over medium heat. Add the onions and salt and cook until very soft and well browned, 15 to 20 minutes. Measure out ¼ cup of the onions, chop them fine, and reserve them for the filling. Cover the caramelized onions to keep warm.
Make the Potato and Cheese Filling: Cover the potatoes by 1 inch of water in a large saucepan and add 1 tablespoon salt. Bring to a boil, then reduce to a simmer and cook until the potatoes are tender and a fork can be slipped easily into the center, 10 to 12 minutes. Drain the potatoes into a colander.
Set a food mill or ricer over a medium bowl and process the potatoes into the bowl. Add the caramelized onions. Stir in the cheeses and butter until incorporated and season with salt and pepper to taste. Cool slightly before filling the pierogi or cover with plastic wrap and refrigerate until needed, up to 2 days.
Assemble the Pierogi: Dust a baking sheet liberally with flour; set aside. Divide the dough into 2 even pieces and cover with plastic wrap. Working with 1 piece of dough at a time, unwrap the dough and roll out on a lightly floured work surface into a 15-inch circle, about 1/16-inch thick. Using a 3-inch round biscuit cutter, cut out as many rounds as possible. Carefully gather up the dough scraps, wrap them in plastic wrap, and set aside.
Place 1 teaspoon of the filling in the center of each dough round and moisten the edge of the dough round with water, using either your finger or a pastry brush. Fold the dough in half over the filling, making a half-moon shape. Pinch the seam along the edge to secure. Crimp the seam using the tines of a fork. Transfer to the prepared baking sheet and cover with a damp kitchen towel. Repeat with the remaining dough.
Gently knead all of the dough scraps together into a ball and let relax for 5 to 10 minutes. Roll out, cut, and assemble additional pierogi, discarding any remaining dough scraps. [MAKE-AHEAD NOTE: The towel-covered baking sheet of pierogi can be wrapped with plastic wrap and refrigerated for up to 4 hours. The pierogi can also be frozen for up to 1 month; once completely frozen, the pierogi can be transferred to a zipper-lock bag. Do not thaw before boiling.]
Cook the Pierogi: Bring 4 quarts of water to a boil in a large pot. Add 1 tablespoon of salt and half the pierogi. Cook, stirring often, until the edges feel al dente, 5 to 6 minutes (8 to 10 minutes if frozen). Using a wire spider or slotted spoon, transfer the pierogi to a colander and set aside. Return the water to a boil and cook the remaining pierogi.
While the second batch of pierogi is boiling, melt 2 tablespoons of the butter in a 12-inch nonstick skillet over medium-high heat. Add the first batch of boiled and drained pierogi and sauté until golden on both sides, 1 to 2 minutes per side. Transfer the browned pierogi to a platter and cover to keep warm. Drain and sauté the remaining pierogi using the remaining 2 tablespoons butter. Sprinkle the caramelized onions over the top and serve with sour cream.