1/4 cup cornstarch
1/3 cup plus 2 tablespoons sugar, divided
3 tablespoons unsweetened cocoa powder
1/4 teaspoon salt
3 cups whole milk
4 ounces bittersweet chocolate (not more than 60% cacao), finely chopped
1 teaspoon pure vanilla extract
1 cup chilled heavy cream
Bittersweet chocolate shavings for garnish (optional)
Prepare pie dough: Roll out dough on a lightly floured surface with a lightly floured rolling pin into an 11-inch round, then fit into a 9-inch pie plate. Trim edge, leaving a 1/2-inch overhang, then fold overhang under and crimp edge decoratively. Prick bottom and side of shell all over with a fork, then chill shell 30 minutes. While shell chills, preheat oven to 375°F with a baking sheet on middle rack. Line shell with foil and fill with pie weights*.
Bake on baking sheet until pastry is set and edge is pale golden, about 25 minutes. Carefully remove weights and foil, then bake shell on baking sheet until pale golden all over, 15 to 20 minutes more. Cool shell.
Make pudding filling: Whisk together cornstarch, 1/3 cup sugar, cocoa powder, and salt in a 2-quart heavy saucepan, then gradually whisk in milk. Bring to a boil over medium heat, whisking constantly, then boil, whisking, two minutes (mixture will thicken). Remove from heat and whisk in chocolate and vanilla until smooth.
Pour filling into cooled shell and chill, its surface covered with wax paper (if you want to prevent a skin from forming), until cold, at least two hours.
Just before serving, beat cream with remaining two tablespoons sugar until it just holds soft peaks. Spoon onto pie and garnish with bittersweet chocolate shavings, if you’re feeling fancy.
Do ahead: Pie dough can be made and chilled up to two days. Pie, without whipped cream, can be chilled up to one day before serving. Whipped cream is best added at the last minute, however, I did find that ours held up surprisingly well for a day (so far), if you feel like winging it.