Slice the yellow onions thinly, about 0.3 cm (⅛ inch), and set aside on a cutting board.
Heat the butter and olive oil together in a large heavy-bottomed pot over medium-low heat until melted and fragrant.
Add the sliced onions to the pot, stirring to coat them evenly in the butter and oil mixture. Cook gently, stirring every 8-10 minutes, allowing the onions to soften and begin caramelizing.
Continue cooking the onions slowly for about 45-60 minutes until they turn a deep amber color and smell sweet and smoky. Adjust the heat if they brown too fast or stick to the bottom.
Meanwhile, preheat your oven to 220°C (430°F). Slice the baguette into 0.5–1 cm (¼ inch) rounds and toast on a baking sheet until golden and crispy, around 8 minutes.
Once the onions are caramelized, pour in the broth, scraping the bottom of the pot to deglaze and incorporate all the flavorful browned bits. Bring the mixture to a gentle simmer and cook for another 10 minutes.
Season the soup with salt and pepper, tasting and adjusting until the sweetness and savoriness are balanced.
Ladle the hot soup into oven-safe bowls or crocks, filling them about three-quarters full.
Top each bowl with a toasted baguette round, then sprinkle generously with shredded Gruyère cheese, covering the bread completely.
Place the bowls on a baking sheet and broil in the oven for 3-5 minutes until the cheese is bubbling and golden brown. Keep a close eye to prevent burning.
Remove the bowls carefully from the oven, let sit for 1-2 minutes to cool slightly, then garnish with a sprig of thyme if desired and serve hot.