Begin by thinly slicing your yellow onions and setting them aside. Preheat your oven to 200°C (390°F).
Heat a large heavy-bottomed pot over medium-low heat, then add the butter. Once melted and foaming, add the sliced onions and stir gently to coat them evenly.
Cook the onions slowly, stirring often, until they soften and begin to turn translucent, about 10 minutes. Keep the heat gentle to prevent burning.
Continue cooking and stirring for about 30-40 minutes, watching as the onions deepen in color from translucent gold to a rich, deep amber. The aroma should be sweet and smoky, filling your kitchen.
Pour in the white wine to deglaze the pot, scraping up any browned bits from the bottom. Let the wine cook off for 2-3 minutes until fragrant.
Add the beef broth along with a sprig of thyme and a pinch of salt. Bring the mixture to a gentle simmer and cook uncovered for another 15 minutes, allowing flavors to meld.
While the soup simmers, toast slices of baguette until golden and crispy, about 8-10 minutes in the oven. Rub with garlic if desired for extra flavor.
Remove the thyme sprig from the soup, taste, and adjust seasoning with salt and pepper as needed.
Ladle the hot soup into oven-safe bowls, float a toasted baguette slice on top of each, and sprinkle generously with grated Gruyère cheese.
Place the bowls on a baking sheet and broil in the oven for 3-5 minutes until the cheese is bubbly and golden brown. Keep a close eye to prevent burning.
Remove from the oven, let sit for a minute to settle, then serve hot with additional thyme or black pepper if desired. Enjoy the rich, gooey, crispy-textured goodness.