Place the store-bought pie crust in a pan and gently press the edges so it sits evenly. Line it with parchment paper and add pie weights or dried beans. Bake until the edges are golden and firm. Let it cool completely before filling to keep the crust crisp.
Combine the sugars, cocoa, and cornstarch, in a medium bowl. Sift the cocoa powder if you want a silky smooth custard. Whisk in the egg yolks until the mixture will be thick. It will smooth out during tempering.
Warm the majority of the milk in a saucepan on medium heat, keeping it just below a boil. Set aside a small amount of milk to gradually temper the eggs, this prevents curdling and ensures a creamy filling. Stir occasionally while heating.
Slowly pour the warm milk into the egg-sugar mixture while whisking constantly. Then, pour it all back into the saucepan and stir over medium heat, keeping it smooth and preventing sticking.
Cook the mixture, stirring constantly, until it thickens enough to coat a spoon (usually about one minute). Remove from heat, fold in the chopped chocolate, butter, and vanilla extract, and stir gently until everything melts into a glossy, rich custard.
Pour the chocolate mixture into the cooled crust and smooth the top. Run your spatula through hot water, then spread for a neat surface. Let the pie sit briefly at room temperature, then refrigerate until fully set.
Whip the heavy cream with sugar and vanilla in a chilled bowl until soft peaks form. Taste as you go if you like! Spread or pipe the whipped cream over the chocolate filling for a light, fluffy topping.
Optionally, sprinkle with finely grated chocolate or chocolate curls for a little extra flair. Enjoy!