Whisk the coconut milk, whole milk, granulated sugar, cornstarch and salt together in a medium saucepan until no lumps of cornstarch remain.
Set the pan over medium heat and cook, whisking constantly, until the mixture thickens and starts to bubble at the edges, about 6 to 8 minutes.
In a separate bowl, whisk the egg yolks, then slowly pour in about 1/2 cup of the hot milk mixture while whisking, to warm the yolks without scrambling them.
Pour the warmed yolks back into the saucepan and cook over medium-low heat for 2 more minutes, whisking constantly, until the filling coats the back of a spoon.
Remove from the heat and stir in the butter, vanilla extract and shredded coconut until the butter melts in.
Pour the filling into the cooled pie crust and smooth the top with a spatula.
Press a sheet of plastic wrap directly onto the surface of the filling to stop a skin from forming, and refrigerate for at least 4 hours, until firmly set.
Just before serving, whip the heavy cream with the powdered sugar to soft peaks that hold their shape when the whisk is lifted.
Spread or pipe the whipped cream over the chilled filling.
Scatter the toasted coconut flakes over the top.
Slice with a warm, dry knife for clean wedges.
Good to Know
The filling can be made a day ahead and chilled right in the crust; add the whipped cream only on the day you serve it.