Place a fine-mesh sieve over a medium bowl; set aside. In a medium saucepan, whisk together sugar, cocoa, cornstarch, and salt. Gradually whisk in milk, taking care to dissolve cornstarch. Whisk in egg yolks.
Whisking constantly, heat over medium until the first large bubble sputters, about 8 minutes. Reduce heat to low; cook, whisking, 1 minute. Remove from heat; immediately pour through sieve into bowl. Add butter, vanilla, and chocolate; stir until smooth.
Place plastic wrap on surface of pudding (to prevent a skin from forming); chill at least 3 hours (or up to 3 days). To serve, whisk until smooth; divide among serving cups, and garnish with shavings.