**Prepare the Crust:** Preheat your oven to 375°F (190°C). Bake the pre-made crust according to package instructions or your recipe. Let it cool completely.
**Make the Chocolate Filling:** In a medium saucepan, whisk together sugar, cornstarch, and salt. Gradually add milk, whisking until smooth. Cook over medium heat, stirring constantly, until the mixture thickens and begins to bubble.
**Temper the Eggs:** In a small bowl, whisk the egg yolks. Slowly add 1/2 cup of the hot milk mixture to the yolks, whisking constantly. Pour the tempered yolks back into the saucepan and cook for 2–3 minutes, stirring constantly.
**Add Chocolate and Flavoring:** Remove the saucepan from heat. Stir in chopped chocolate, butter, and vanilla extract until smooth.
**Cool the Filling:** Pour the filling into the cooled pie crust. Cover the surface with plastic wrap to prevent a skin from forming. Refrigerate for at least 4 hours, or until firm.
**Prepare the Whipped Cream:** In a chilled mixing bowl, beat heavy cream, powdered sugar, and vanilla extract until soft peaks form.
**Assemble the Pie:** Spread the whipped cream over the chilled chocolate filling. Garnish with chocolate shavings or a dusting of cocoa powder, if desired.