Preheat the oven to 350°F and generously butter a 2-1/2 to 3 quart oblong baking dish.
Fry the bacon until crisp, transfer to a paper towel-lined plate and set aside. Reserve about 1-1/2 tablespoons of the bacon fat in the pan and discard the rest.
Heat the bacon fat over medium-low heat and add the onion. Cover the pan and cook for 8 to 10 minutes, stirring 3 or 4 times during the process.
Remove the cover, raise the heat to medium and continue cooking until the onions are lightly caramelized, 6 to 8 minutes longer. Remove from the heat, add the reserved bacon and combine well. Season to taste with salt and pepper and set aside.
Melt 4 tablespoons of the butter in a large, heavy saucepan. Sprinkle in the flour, whisk until well combined and continue cooking until the mixture develops a pale golden color, 3 to 4 minutes.
Gradually add the milk, whisking until smooth and well blended. Continue cooking, whisking frequently, 7 to 8 minutes or until the sauce is smooth and thick enough to coat the back of a spoon. Season to taste with salt and pepper.
Note: Be sure to scrape down the sides of the pan with a spatula once or twice to ensure there are no lumps in the sauce.
Remove the pan from the heat, add the cheese a handful at a time and stir until completely melted. Add the macaroni and combine well. Taste and adjust the seasoning if necessary, then mix in the reserved bacon and onions.
Transfer the mixture to the prepared baking dish and bake, uncovered for 15 minutes.
While the macaroni bakes, heat the remaining tablespoon of butter over medium heat and add the garlic. Sauté until fragrant, 1 minute, then add the breadcrumbs and toss to combine.
Continue cooking, stirring often, until the crumbs are lightly toasted, 3 minutes longer.
Remove the macaroni from the oven, top with the crumb mixture, then return to the oven for an additional 5 to 7 minutes.
Allow the casserole to rest for 10 minutes before serving.