In a medium saucepan whisk together sugar, cocoa powder, and salt until well combined and no lumps of cocoa remain. Stir in 3 ½ cups of milk and heat on medium heat until steamy, about 5 minutes, whisking occasionally.
In a bowl, whisk together egg yolks, cornstarch, and ½ milk until well combined.
When chocolate mixture is heated, temper the egg mixture by pouring a thin steady stream of the hot chocolate mixture into the egg mixture, whisking constantly.
Return mixture to saucepan and cook on medium heat until pudding thickens and becomes bubbly, 10-15 minutes. Continue to cook pudding for a minute whisking constantly.
Remove pan from heat and stir in instant espresso powder, vanilla, and butter until fully incorporated.
Pour pudding through a fine mesh strainer to remove any lumps. Cover pudding with a layer of plastic wrap, touching the wrap directly to the surface of the pudding to prevent a thick layer of skin from forming.
Refrigerate pudding for at least 4 hours before serving.
When ready to serve, scoop pudding into cups or small bowls, topping with whipped cream and chocolate shavings. Recipe make 8 – 4-ounce servings.