Preheat the oven to 350°F (175°C). If using a pre-baked pie crust, ensure it is ready for the filling.
In a medium saucepan, combine the granulated sugar, cornstarch, and salt. Gradually whisk in the whole milk until smooth and combined.
Place the saucepan over medium heat, stirring constantly until the mixture thickens and begins to boil. Once boiling, continue to whisk for an additional 1-2 minutes.
In a separate bowl, lightly beat the egg yolks. Slowly add a small amount of the hot milk mixture to the yolks to temper them, whisking continuously. Then, pour the yolk mixture back into the saucepan.
Stir in the shredded coconut, butter, vanilla extract, and coconut extract (if using). Cook for another 2-3 minutes until the custard is thick and creamy.
Pour the coconut custard filling into the prepared pie crust. Smooth the top with a spatula and let it cool to room temperature before refrigerating for at least 4 hours or until set.
Once the pie has chilled, prepare the whipped cream. In a mixing bowl, combine the heavy whipping cream and powdered sugar. Using an electric mixer, beat until stiff peaks form.
Spread the whipped cream evenly over the chilled pie. Finally, sprinkle the toasted shredded coconut on top of the whipped cream.
Slice and serve chilled. Enjoy your Old-Fashioned Coconut Cream Pie!