Mix the dough: In the bowl of a stand mixer (or a large bowl), whisk flour, sugar, yeast, and salt. Add warm milk, eggs, and vanilla. Mix on low until a shaggy dough forms.
Add the butter: With the mixer running on medium-low, add softened butter a tablespoon at a time.
Mix 6–8 minutes until the dough is smooth and slightly tacky but pulls from the sides.
First rise: Lightly grease a bowl, place dough inside, cover, and let rise in a warm spot until doubled, about 1–1.5 hours. If your kitchen is cool, it may take longer.
Make the filling: In a small saucepan over low heat, melt butter and chocolate, stirring until smooth. Remove from heat.
Whisk in powdered sugar, cocoa, espresso powder, and salt. Cool until spreadable and thick.
Roll the dough: Turn dough onto a lightly floured surface. Roll into a 12x16-inch (30x40 cm) rectangle with the long side facing you.
Spread and chill: Spread the filling evenly, leaving a 1/2-inch border.
Roll up tightly from the long edge into a log. Transfer to a baking sheet and chill 10–15 minutes to firm slightly.
Shape the babka: Using a sharp knife, slice the log lengthwise to expose the layers. With the cut sides facing up, twist the two strands together, crossing them over each other 3–4 times.
Pan it: Line a 9x5-inch (23x13 cm) loaf pan with parchment, letting it overhang for easy removal.
Lift the twisted dough into the pan, tucking the ends under as needed.
Second rise: Cover loosely and let rise until puffy and just cresting the pan, about 45–75 minutes depending on room temp.
Preheat and bake: Preheat oven to 350°F (175°C). Bake 35–40 minutes, until deep golden and an instant-read thermometer in the center reads about 190–195°F (88–90°C). If browning too fast, tent with foil.
Make the syrup: While it bakes, combine sugar and water in a small saucepan.
Bring to a simmer, stir to dissolve, then remove from heat.
Glaze the loaf: Immediately after removing the babka from the oven, brush the hot syrup generously over the top and any exposed swirls. Use all the syrup.
Cool and serve: Cool in the pan 15 minutes, then lift out to a rack. Serve warm or at room temp.
Slice with a serrated knife for clean layers.