Slice your onions into ¼-inch moons and set aside. Mince your garlic finely so it distributes evenly throughout the soup. Toast your baguette slices in a 450°F oven for about 5 minutes until golden and crispy, then set aside. Heat 7 tablespoons of olive oil in a large heavy-bottomed pot over medium heat until shimmering. Add the sliced onions and sea salt, stirring to coat everything evenly. The salt will help the onions release their moisture and begin breaking down.
Reduce heat to medium-low and cook the onions for 40 minutes, stirring occasionally every 8-10 minutes. This slow cooking allows the onions to gradually release their natural sugars and develop a deep, sweet flavor without browning too quickly.
Increase heat to medium and continue cooking for 15-20 minutes, stirring more frequently (every 3-4 minutes) until the onions develop a rich, deep brown color.
Add the balsamic vinegar, tamari, thyme leaves, and minced garlic to the caramelized onions, stirring constantly for about 1 minute to release the garlic's aromatics and let the vinegar and tamari meld into the onions.
Sprinkle the flour over the mixture and stir vigorously for 2 minutes—this cooks out the raw flour taste and creates a roux that will thicken your broth while adding body and richness to the soup.
Pour in the dry white wine, stirring constantly and scraping the bottom of the pot to release all the flavorful browned bits. Cook for 2 minutes to reduce the wine slightly and cook off some of the alcohol, then add the vegetable broth and bay leaf.
Bring to a gentle simmer and cook for 30 minutes, allowing all the flavors to meld and the soup to develop a silky, cohesive taste. Taste and adjust seasoning with black pepper and a pinch of red pepper flakes if desired.
Ladle the hot soup into oven-safe bowls and top each bowl with a toasted baguette slice. Pile freshly shredded gruyère cheese generously on top of the bread.
Place the bowls on a sheet pan and bake at 450°F for 8-10 minutes until the cheese is melted, bubbly, and golden brown with slightly crispy edges.