Bake and cool the pie crust: Roll out homemade crust and fit into a 9 inch pie plate. Prick bottom with fork, line with parchment, and fill with pie weights. Bake at 375°F for 15 minutes, remove weights, then bake another 8-10 minutes until golden. Cool completely on a wire rack.
Whisk the dry ingredients together: In a medium saucepan off the heat, whisk together granulated sugar, cocoa powder, cornstarch, and salt until completely free of lumps.
Add the milk and egg yolks: Slowly pour in whole milk while whisking constantly, then add egg yolks and whisk until smooth and uniformly colored. Place saucepan over medium heat.
Cook the pudding: Whisk constantly as the mixture heats for 8-10 minutes until it thickens and coats the back of a spoon. Bring to a full simmer with thick bubbles, cook one additional minute while whisking, then remove from heat.
Stir in the chocolate, butter, and vanilla: Add chopped bittersweet chocolate and whisk until fully melted. Stir in butter and vanilla extract until glossy and completely smooth.
Strain the filling: Pour pudding through a fine mesh sieve set over a clean bowl, pressing with a spatula to remove any lumps.
Fill the pie crust: Pour strained pudding into cooled baked pie crust and spread evenly. Press plastic wrap directly onto the surface to prevent a skin from forming.
Chill the pie: Refrigerate for at least 3 hours until completely set, or overnight for best slicing results.
Make the whipped topping: Just before serving, beat cold heavy cream and powdered sugar with a hand mixer on medium-high until stiff peaks form, about 2-3 minutes.
Top and serve: Remove plastic wrap from chilled pie, spread or pipe whipped cream on top, garnish with chocolate shavings if desired. Slice with a sharp knife dipped in warm water for clean cuts.