Melt butter in a skillet over medium heat, add onion, and cook until golden and fragrant. Pan-fry pierogi 2–3 minutes per side until lightly crisp and golden brown.
Remove with a slotted spoon and drain well.
Place 1 tablespoon of filling in the center of each circle. Fold in half and press edges firmly to seal, crimping with a fork.
Bring a large pot of salted water to a gentle boil. Cook pierogi in batches until they float, about 2–3 minutes.
Roll the dough to ⅛-inch thickness and cut into 3-inch circles. The dough should feel soft but not sticky.
In another bowl, combine mashed potatoes, cheese, salt, and pepper until creamy and well blended.
Knead the dough on a floured surface for 5–7 minutes until smooth and slightly elastic. Cover and let rest for 20 minutes.
In a large bowl, mix flour and salt. Add egg, sour cream, and warm water, stirring until a soft dough forms.