Prepare the crust: If using a premade crust, bake according to the package instructions and let it cool.
Make the filling: In a medium saucepan, whisk together coconut milk, sugar, and cornstarch. Cook over medium heat, stirring constantly until the mixture thickens and comes to a simmer.
Temper the egg yolks: Slowly add a small amount of the hot coconut milk mixture to the beaten egg yolks, whisking constantly to avoid curdling. Gradually whisk the egg yolk mixture back into the saucepan.
Cook the filling: Continue to cook for another 2–3 minutes until the filling is thick and smooth. Remove from heat and stir in shredded coconut and butter until the butter is melted.
Cool the filling: Let the filling cool for a few minutes before pouring it into the baked pie crust.
Chill the pie: For at least 2 hours to allow the filling to firm up, which makes slicing easier and enhances the flavor.
Serve and garnish: Top with toasted coconut just before serving for a crunchy, golden finish.