Preheat your oven to 350°F and coat a 9×13-inch glass or ceramic baking dish with non-stick cooking spray.
In a large mixing bowl, combine the ground beef, finely chopped yellow onion, dry breadcrumbs, BBQ sauce, beaten egg, chili powder, garlic powder, salt, and black pepper.
Use your hands or a sturdy spoon to mix the elements together just until combined. Avoid overworking the meat baseline, as over-handling binds the proteins too tightly and results in a dense, tough texture.
Transfer the meat mixture to the prepared baking dish and gently press it down into a flat, uniform layer across the entire bottom of the pan.
Place the pan on the middle oven rack and bake uncovered at 350°F for 25 to 30 minutes. The meat baseline is ready when it is completely cooked through and its internal temperature registers 160°F on a digital kitchen thermometer.
While the meatloaf cooks, prepare the potatoes. Place the cubed potatoes into a large pot, cover completely with cold water, and bring to a rolling boil over high heat. Cook for 15 to 20 minutes until completely fork-tender.
Drain the potatoes thoroughly in a colander, then return them to the warm pot. Add the melted butter and gradually pour in the warm milk, mashing aggressively with a potato masher until the texture turns thick, creamy, and smooth. Season with a pinch of extra salt to preference.
Carefully remove the baked meatloaf from the oven and tilt the pan to drain away any pooling surface grease. Adjust your oven setting from bake to Broil.
Using an offset spatula, spread the warm mashed potatoes uniformly over the top of the baked meatloaf layer, smoothing it into an even blanket that seals the corners.
Scatter the shredded cheese, crumbled bacon pieces, and crispy fried onions evenly across the entire surface of the mashed potato layer.
Return the casserole to the oven, positioning it roughly 4 to 6 inches away from the broiler element. Broil for 3 to 5 minutes, keeping a watchful eye on the pan, until the cheese matrix is entirely melted, bubbly, and beautifully golden brown. Let the casserole rest for 5 minutes to settle the layers before slicing into hearty portions and serving hot.