In a medium saucepan, whisk together the sugar, cocoa powder, cornstarch, and salt until no clumps remain.
Gradually pour in 1/2 cup of the milk, whisking constantly until the mixture forms a smooth, thick paste.
Slowly pour in the remaining milk, whisking until the mixture is uniform and thin.
Place the saucepan over medium heat and cook, stirring constantly with a spatula, for about 8 to 10 minutes, or until the mixture begins to bubble and thicken significantly.
In a small bowl, temper the egg yolks by adding about 1/4 cup of the hot pudding mixture to the yolks while whisking vigorously to prevent curdling.
Pour the tempered yolk mixture back into the saucepan and continue to cook over medium-low heat for another 2 minutes, stirring constantly until the custard is glossy and thickened.
Remove the pan from the heat and stir in the butter and vanilla extract until completely incorporated and smooth.
Pour the pudding into individual serving dishes or a large bowl and press a piece of plastic wrap directly onto the surface to prevent a skin from forming.
Refrigerate for at least 3 hours or until completely chilled and set before serving.