Make the Pie Crust: In a bowl, mix flour and salt. Cut in cold butter until the mixture resembles coarse crumbs. Add ice water, one tablespoon at a time, mixing until the dough forms. Shape into a disk, wrap, and chill for 30 minutes.
Roll and Bake: Preheat oven to 375°F (190°C). Roll out the dough, fit it into a 9-inch pie pan, and crimp the edges. Prick the bottom with a fork, line with parchment, and add pie weights. Bake for 15 minutes, remove weights, and bake for 5-7 more minutes until golden. Cool completely.
Make the Filling: In a saucepan, whisk sugar, cocoa powder, cornstarch, and salt. Slowly add milk, whisking to prevent lumps. Cook over medium heat, stirring, until thickened (7-10 minutes). Reduce heat to low.
Temper the Eggs: Slowly whisk a small amount of the hot mixture into the beaten egg yolks. Pour back into the saucepan and cook for 2 minutes, stirring constantly.
Finish the Filling: Remove from heat, stir in butter and vanilla, and mix until smooth. Strain if needed for a silkier texture.
Assemble and Chill: Pour the warm filling into the cooled crust, smooth the top, and let it cool to room temperature. Refrigerate for at least 4 hours or overnight.
Garnish and Serve: Top with whipped cream and chocolate shavings before slicing and serving.