Preheat your oven to 375°F (190°C).
Sauté the chopped onion in a skillet over medium heat until translucent, about 5 minutes.
Combine the cooked corned beef, sautéed onions, mashed potatoes, cheese, garlic powder, and black pepper in a large bowl.
Pour the filling into the pie shell, smoothing it out evenly.
Cover the filling with the second pie crust and seal the edges by crimping them together.
Cut slits into the top crust to allow steam to escape during baking.
Brush the top with the beaten egg for a golden finish.
Bake in the preheated oven for 30-35 minutes or until the crust is golden brown.
Allow the pie to rest for 10 minutes before slicing.