In a large skillet, melt butter with olive oil over medium heat. Add sliced onions and cook low and slow for 30-40 minutes until deeply caramelized.
Meanwhile, in another skillet, brown ground beef over medium-high heat. Drain any excess fat and set aside.
Preheat oven to 375°F (190°C).
In a large mixing bowl, combine caramelized onions, cooked ground beef, uncooked rice, beef broth, Worcestershire sauce, thyme, bay leaf, and sherry if using. Season with salt and pepper.
Transfer mixture into a greased 9x13-inch baking dish. Cover tightly with foil and bake for 45 minutes.
Remove foil, top with Gruyère and mozzarella cheese, and return to oven uncovered for an additional 15 minutes, or until cheese is bubbly and golden.
Let rest for 10 minutes before serving.