Caramelize the onions. Set a wide skillet over medium heat. Add olive oil and 1 tablespoon butter. When shimmering, add sliced onions, a pinch of sugar, and a pinch of salt. Cook, stirring occasionally, 20 to 30 minutes. Lower heat if they brown too fast. You want soft, deep golden, jammy onions. If the pan dries, add a splash of water. When done, set aside to cool completely. This step smells like a cozy bistro, so let it happen. Breathe.
Make the dough. In a large mixing bowl, whisk flour, sugar, salt, and instant yeast. Add warm milk, warm water, egg, and softened butter. Mix with a wooden spoon until shaggy. If using active dry yeast, bloom it first: mix warm milk, warm water, and sugar with the active dry yeast, let it foam 5 to 10 minutes, then add to the dry ingredients with the butter and egg.
Knead. Turn dough onto a lightly floured surface and knead 8 to 10 minutes until smooth and elastic. It should feel soft and slightly tacky but not sticky. If the dough is very sticky, dust in 1 to 2 tablespoons more flour. If using a stand mixer, knead on medium-low 6 to 7 minutes. You’re looking for a dough that stretches without tearing easily.
First rise. Shape dough into a ball and place in a lightly oiled bowl. Cover with a clean towel or plastic wrap. Let rise in a warm, draft-free spot until doubled, about 60 to 90 minutes. A slightly warm oven with the light on works well.
Prepare the filling. Pat the cooled onions with a paper towel if they look oily. Toss your shredded cheese in a small bowl. If using Parmesan, mix it in now.
Shape the loaf. Gently deflate the dough and roll it into a rectangle, roughly 10 by 14 inches. Spread the onions evenly, leaving a small border around the edges. Sprinkle the cheese over the onions. Starting from a long side, roll the dough into a snug log. Pinch the seam to seal, then tuck the ends under.
Pan and proof. Lightly grease a 9 by 5 inch loaf pan. Place the log seam side down in the pan. Cover and let rise until the dough crowns about 1 inch over the rim, 35 to 50 minutes, depending on the room temperature. When gently poked, the dough should spring back slowly. That’s your cue.
Preheat the oven to 375°F (190°C). If your oven runs hot, keep a piece of foil nearby in case the top browns too quickly.
Bake. Brush the top lightly with milk or water for a softer crust. Bake 30 to 35 minutes until the loaf is deep golden and sounds hollow when tapped, or until an instant-read thermometer in the center registers 195 to 200°F (90 to 93°C). If it’s browning early, tent with foil for the last 10 minutes.
Finish and cool. Optional but lovely: brush the hot loaf with the garlic butter. Cool in the pan 10 minutes, then transfer to a rack to cool at least 30 minutes before slicing. Yes, waiting is hard. The crumb sets as it cools, and the cheese stays where it should.
Serve. Slice thick for dunking into soup, or tear big pieces to go with a salad. Leftovers make excellent toasted sandwiches the next day. If there are leftovers.