Place the cubed potatoes in a pot of salted water and boil until tender. Drain, then mash with the milk, 2 tablespoons of butter, and a pinch of salt until smooth. Set aside.
Heat a large skillet over medium heat and cook the ground beef until browned. Add the diced onion and carrots, then cook until the vegetables soften.
Stir in the frozen peas and season with salt and pepper. Spoon the mixture into a baking dish and spread the mashed potatoes evenly over the top. Dot with the remaining tablespoon of butter.
Bake at 375 degrees for 20 minutes until the potato topping turns lightly golden.
While the pie bakes, melt the remaining butter in the same skillet. Add the sliced onion and cook until soft. Sprinkle in the flour, stir for one minute, then slowly whisk in the beef broth. Simmer until the gravy thickens. Season with salt and pepper.
Let the pie rest a few minutes after baking, then serve slices with the onion gravy spooned over the top.