Peel and chunk the potatoes, then boil in salted water until properly soft - a knife should slide through with no resistance. Drain very well and mash by hand with a fork or a ricer. Don't reach for the blender; it turns the filling to wallpaper paste.
While the potatoes cook, melt the butter in a pan over a medium-low heat and add the onions. You want them to go past pale gold to a deep amber - takes 15-20 minutes, don't rush it. Half goes into the filling, half stays back for serving.
Crumble the twaróg into the warm mash, add half the cooked onion, season generously with salt and pepper. Taste and adjust. Set the filling aside to cool while you make the dough - cold filling is much easier to work with.
Tip the flour onto a clean surface or into a wide bowl, mix in the salt and the oil. Slowly add the hot water, drawing the flour in as you go, until you have a smooth, slightly tacky dough. Don't add all the water at once - the right amount depends on your flour. Knead for a few minutes until silky, then cover and rest for 15 minutes.
Roll the dough out thin - about 2mm. Cut circles with a glass (roughly 7cm across). Put a teaspoon of filling on each circle, fold over, and seal the edges firmly. Press out any trapped air or the pierogi will burst in the pan.
Bring a large pot of salted water to a gentle boil. Drop the pierogi in batches - don't crowd them. They sink, then float. Once they've floated, give them another minute, then lift them out with a slotted spoon.
Serve hot, with the rest of the caramelised onion piled on top. A spoonful of sour cream on the side is traditional. Any leftovers fry beautifully in butter the next day.