In a medium, heavy-bottomed pot, whisk together the sugar, cornstarch, cocoa powder, espresso powder (if using), and salt. Add the egg yolks and about ⅓ of the milk, whisking until smooth. Gradually whisk in the remaining milk, then stir in the chopped chocolate.
Set the pot over medium heat. Cook the mixture, whisking constantly and occasionally scraping the thickened pudding off the edges of the pan with a rubber spatula, until the pudding thickens fully and large bubbles start to form and pop, about 8 minutes.
Remove from the heat and immediately strain the pudding through a fine-mesh strainer into a bowl, using the spatula to push all the pudding through the strainer. Stir in the butter and vanilla extract until fully incorporated.
Leave the pudding in the bowl, or divide it into individual serving dishes and smooth the top. Cover the surface of the pudding with plastic wrap to prevent a skin from forming. Allow it to cool to room temperature before transferring it to the refrigerator to chill for at least 3 hours or overnight.
Make the Whipped Cream:
When ready to serve, place the cream, sour cream, granulated sugar, and vanilla extract in the bowl of an electric mixer fitted with a whisk attachment. Beat on medium speed until the cream forms soft stiff peaks, scraping the bowl halfway through, about 2 minutes.
Serve the chilled pudding with the whipped cream on top. Refer to the note for additional serving suggestions.