Make the stock: Preheat an oven to 400° F. Line a large rimmed baking sheet with aluminum foil, place the bones on it, transfer to the oven, and roast until the bones are sizzling and browned and most of the fat has rendered, about 1 hour.
In a large stockpot, add the bones (reserving the pan drippings) and the rest of the stock ingredients. Cover with 1 gallon cold water, then place over high heat and bring to a boil. Skim and discard any foam that forms on the surface, then lower the heat to maintain a strong simmer. Cook, uncovered, until the liquid has reduced by half, about 2½ hours.
Remove the stock from heat and set aside to cool slightly. Line a large mesh strainer with cheesecloth and place it over a large heatproof bowl. Strain the stock, discarding the solids, and let it rest for 10 minutes. Skim and discard any grease that collects on the surface. Measure 8 cups of the stock; reserve any extra for another use.
Make the soup: In a large pot or deep skillet over medium heat, add 8 tablespoons butter and 2 Tbsp. of the reserved beef drippings. When the foam begins to subside, add onions and sugar (if using), and season lightly with salt and black pepper. Cook, stirring frequently, until the onions have entirely wilted (8–10 minutes), then lower the heat to medium-low and cook, stirring frequently, until they turn soft and golden brown but have not yet completely broken down, 60–70 minutes. Turn off the heat, then cover to keep the onions warm as you finish the soup.
Spread the remaining butter on both sides of the baguette slices. In a heavy skillet over medium-high heat, toast the bread on both sides until crispy and browned, 8–10 minutes. Rub each slice all over with the cut side of a garlic clove, then set the toast aside.
In a large bowl, combine the cheeses and set aside.
Preheat the broiler and place an oven rack directly below it. Meanwhile, wash out the stockpot and return it to medium-high heat. Add the reserved 8 cups beef stock, bring to a boil, then add the white wine and sherry. Lower the heat to maintain a simmer, and cook just until you can no longer smell the alcohol, 5–7 minutes. Season to taste with additional salt and black pepper.
Line a large rimmed baking sheet with aluminum foil, and place 6 ovenproof soup bowls on it. Divide the onions between the bowls (about ⅓ cup in each), then ladle the hot broth into each bowl to cover the onions. Cover each bowl with two slices of toast, then pile them generously with the reserved cheese. Carefully transfer the bowls to the broiler and cook until the cheese is melted, bubbly, and browned in places, 5–10 minutes. Serve immediately.