In a small saucepan, warm the milk to around 95-104°F / 35-40°C but not hotter. Pour it into a bowl of a stand mixer. Sprinkle yeast and sugar over the milk. If using active dry yeast, let this sit for around 5-10 minutes until it becomes foamy; if using instant yeast, this step can be skipped.
Add in the flour, salt, and egg. Fit the stand mixer with a dough hook attachment and mix on low speed to form a thick dough.
Add in the softened butter, a few cubes at a time, and keep mixing on medium speed for around 10 minutes until the soft dough is smooth and strong and it pulls away cleanly from the sides of the bowl. Alternatively, knead by hand for around 10 minutes until it becomes a strong and smooth dough. If you need a break, take it. The dough responds well to resting time.
Once kneaded, form the dough into a dough ball. Transfer the dough to a lightly greased medium bowl and cover it with plastic wrap or a dampened clean kitchen towel.
Let the dough rise in a warm place until doubled in size, around about 1 hour. The exact rise time will depend on your room temperature.
Grease or line a 9x5-inch loaf pan
Pull the risen bread dough from the bowl onto a lightly floured surface. Form the dough into a 12-inch (30cm) long log and cut it into 12 equal 1-inch pieces with a bench scraper or knife. If you want them even, weigh the whole dough first and divide it by 12.
Shape each piece into a little ball. Roll each ball into a circle around 4 ½ inches (11cm) in diameter.
Spread each piece with about ¾ teaspoon of pesto, leaving a little border around. Add a sprinkle of cheese, then fold the dough circle in half.
Place the half circle into the loaf pan with the edges facing up. Continue with the remaining dough and pesto, stacking the layers of dough. You might need to balance the loaf pan with the long end facing up when you add the dough so the pieces don't fall flat.
Cover the loaf pan with compostable plastic wrap or place it in a warm and humid place to rise again until doubled in size. You can create a warm and humid spot by placing the bread in a turned-off oven next to a mug of boiled water.
Preheat the oven to 350°F (180°C).
Bake the pesto bread for around 35 minutes until deep golden brown. If it is browning too fast, you can cover the top of the pesto bread with aluminum foil.
Brush the top of the bread with melted butter and sprinkle with flaky salt.
Notes
Use the toggle to switch between metric and cups. The cup sizes given are US cups. Please note that these are smaller than metric cups. For best results use grams.