Drain soaked beans and place into a large heavy saucepan. Add ½ onion, Parmesan rind, whole garlic cloves, bay leaf, and salt. Add water and cover by about 2 inches. Bring to a boil, reduce heat and simmer until beans are soft and tender, about 1 hour.
Meanwhile, in a small saucepan, cook pancetta until the fat is rendered and it starts to get crispy. Using a slotted spoon, transfer to paper towel lined plate. Set aside.
Add thinly sliced onion, minced garlic, and shallot to pan. Cook on medium until onions have started to caramelize, adding additional olive oil if needed, about 10 minutes. Add wine, bring to a simmer, and cook until liquid mostly evaporates. Season with salt and pepper to taste.
Preheat oven to 400F.
Drain beans, reserving about 1 cup liquid, and remove Parmesan rind and bay leaf. In a large bowl, combine beans, pancetta, cooked onions and shallot, thyme, gruyere, freshly ground black pepper, and reserved cooking liquid. Stir until combined, then transfer to a 9 by 5 inch bread pan or equivalent.
Mix breadcrumbs with olive oil and sprinkle on top of beans. Bake for 45-50 minutes until the top is a nice golden brown. Let cool slightly before serving.