To make the dough: put the milk into a large bowl (or the bowl of a stand mixer) and sprinkle over the yeast and a pinch of the sugar. Let stand for a few minutes, until it gets foamy. (If it does nothing, toss it and get some fresh yeast.) Add about half the flour along with the remaining sugar, eggs, vanilla and salt and stir or beat with a dough hook until well combined. Add the remaining flour and stir or beat, adding the butter a few pieces at a time, until you have a sticky, smooth dough. (It should be very soft and tacky, but as sticky as batter - it will smooth out and be easier to handle as it rises.) Shape into a ball, place in the bowl and cover with a tea towel for 2 hours.
In a small saucepan, melt the butter and chopped chocolate over medium-high heat, stirring until smooth. Remove from the heat and stir in the brown sugar and cocoa; the mixture will have the consistency of thick paste.
Line two 8x4-inch loaf pans with parchment. Punch the dough down and divide it in half. Roll out each piece on a lightly floured surface into a 10x12-inch rectangle. Spread each piece with half the chocolate mixture. Starting at a long side, roll up jelly roll style. To shape the loaves, either turn the ends together, pinching to make a ring, stretch the ring out even wider and twist it twice, like a double figure 8, and tuck into the pan, or cut the log in half lengthwise, lay them side to side and pinch them together at the top to join, then weave the pieces back and forth over each other, like braiding but with only two pieces. Tuck into the baking pan, tucking in the edges. Don’t worry about it being perfect.
Cover and let rise for another hour or two. When you’re ready to bake, preheat the oven to 350F, brush the tops of the loaves with beaten egg, and bake for about 45 minutes, or until deep golden and somewhat springy to the touch, especially in the middle. (Some recipes say the bottoms should sound hollow when tapped, but I find the dough is too dense and loaded with chocolate for this to be an accurate gauge.) Try to let them cool almost completely before slicing - but chocolate babka is pretty fabulous while it’s still warm.
Makes 2 loaves.