Arrange your pre-baked pie crust on a cooling rack to ensure even temperature. Gather all ingredients and measure them precisely before starting.
Combine sugar, cornstarch, and salt in a medium saucepan. Whisk together over medium heat until thoroughly mixed and the mixture becomes slightly lumpy but cohesive.
Gradually pour in the milk while whisking continuously to prevent lumps. Cook over medium heat, stirring constantly, until the mixture begins to bubble and thickens, about 5-7 minutes. You should see steam rising and the mixture coating the back of a spoon.
Reduce heat to low. In a separate small bowl, lightly beat egg yolks. Slowly add a few spoonfuls of the hot mixture into the yolks, whisking constantly to temper. Then, pour the yolk mixture back into the saucepan, stirring constantly.
Cook the custard for an additional 2-3 minutes until it is very thick and glossy. Remove from heat. Stir in shredded coconut, unsalted butter, and vanilla extract. Continue stirring until the butter is fully melted and incorporated. The filling should be smooth and slightly pudding-like.
Pour the hot coconut custard evenly into the prepared pie crust. Smooth the surface with a spatula and let it cool to room temperature, then refrigerate for at least 2 hours or until fully set and chilled. Serve cold, garnished as desired.