Toast the coconut: Preheat oven to 350°F (175°C). Spread 1/4 cup shredded coconut on a small baking sheet and bake for 3–5 minutes until golden. Set aside to cool.
Keep the oven on.
Make the crust: In a bowl, mix almond flour, shredded coconut, sweetener, and salt. Stir in melted butter and vanilla until the mixture resembles damp sand.
Press and bake: Press the crust mixture into a 9-inch pie plate, working it up the sides. Dock with a fork.
Bake for 10–12 minutes, until lightly golden. Cool completely.
Bloom the gelatin: Sprinkle gelatin over 2 tablespoons cold water in a small bowl. Let it sit 5 minutes to soften. (For agar, you’ll add it to the hot mixture later.)
Heat the dairy: In a saucepan, add coconut milk, heavy cream, sweetener, and salt.
Warm over medium heat until steaming, not boiling, stirring to dissolve sweetener.
Temper the yolks: Whisk egg yolks in a separate bowl. Slowly drizzle in 1/2 cup of the hot mixture while whisking. Then pour the tempered yolks back into the saucepan, whisking constantly.
Cook the custard: Stir over medium-low heat until the mixture thickens slightly and coats the back of a spoon, about 5–7 minutes.
Do not boil.
Add thickener and flavor: Remove from heat. Whisk in the bloomed gelatin until fully dissolved (or whisk in agar and simmer gently for 2–3 minutes to activate). Stir in vanilla, butter (if using), and the toasted coconut.
Cool and fill: Let the filling cool 10–15 minutes, stirring occasionally to prevent a skin.
Pour into the cooled crust. Smooth the top.
Chill to set: Cover and refrigerate at least 4 hours, preferably overnight, until firm.
Whip the topping: Beat heavy cream with powdered sweetener and vanilla to soft peaks. If using coconut cream, use well-chilled cream and a chilled bowl.
Finish and serve: Spread or pipe the whipped topping over the set pie.
Sprinkle with toasted coconut flakes. Slice with a sharp knife and serve cold.