Slice all onions thinly and set aside.
Melt butter in a large pot over medium heat.
Add all onions and cook, stirring occasionally, for 30–35 minutes until deeply caramelized.
Add thyme and bay leaves and stir to combine.
Deglaze with broth + lemon juice mixture, scraping browned bits from the pot.
Add beef broth and chicken broth and stir well.
Season with salt and pepper to taste.
Bring soup to a gentle simmer.
Cover partially and cook 20–25 minutes.
Meanwhile, preheat the oven broiler.
Arrange baguette slices on a baking sheet.
Brush with olive oil if desired.
Broil 2–3 minutes until lightly toasted.
Ladle hot soup into oven-safe bowls.
Top each bowl with a toasted baguette slice.
Place a slice of Gruyere on top of each serving.
Broil bowls 2–4 minutes until cheese is melted and bubbling.
Serve immediately while hot and gooey.