Cook the chopped bacon in a large skillet over medium heat until crispy. Transfer it to a paper towel-lined plate, reserving some for the topping. Leave up to ¼ cup of bacon fat in the skillet.
Add the sliced onions, shallots, and a pinch of salt to the skillet. Cook over medium-low heat for 40–50 minutes, stirring occasionally, until the onions are deeply golden and soft. Add small splashes of water as needed to loosen the browned bits and prevent the onions from burning.
During the last 2–3 minutes of cooking, stir in the minced garlic, thyme, balsamic vinegar, brown sugar, and Worcestershire sauce. Remove from the heat and allow the mixture to cool slightly.
Preheat the oven to 350°F. In a large bowl, combine the softened cream cheese, sour cream, and mayonnaise, mixing until smooth.
Reserve about ½ cup of the shredded cheese mixture for the topping. Stir the remaining cheese into the creamy base, then fold in the caramelized onion mixture and cooked bacon. Season with freshly cracked black pepper.
Spread the mixture evenly into a shallow 2- to 3-quart baking dish. Sprinkle the reserved shredded cheese and bacon over the top.
Bake for 20–25 minutes, or until the dip is heated through and bubbling around the edges.
Sprinkle the crispy fried onions over the dip and broil for 1–2 minutes, watching closely, until golden.
Allow the dip to rest for 5 minutes before serving warm with crackers or toasted sourdough.