Whisk together the flour, cocoa powder, sugar, and salt in a large bowl. Add the butter and mix with a pastry blender or a fork until the mixture resembles coarse meal and the butter is the size of small peas.
Add 2 tablespoons of water and continue mixing. Add more water as needed, 1 tablespoon at a time, until a dough forms.
Wrap the dough tightly in plastic wrap. Refrigerate for at least 2 hours or up to overnight.
Remove the dough from the refrigerator. If necessary, let it sit at room temperature for 10 to 15 minutes until slightly softened but still cold.
Lightly flour a work surface. Roll out the dough into a circle about 1/8-inch thick.
Transfer the dough to a 9-inch pie plate or tart pan. Trim and crimp the edges as desired. Place the pie plate in the refrigerator while you make the filling.
To make the filling:
Preheat oven to 325°F (160°C).
Whisk together the butter, eggs, sugar, brown sugar, milk, vanilla, cornmeal, and salt until thoroughly combined. Stir in the coconut.
Transfer the filling mixture to the chilled pie crust. Place the pan on a lined, rimmed baking sheet to catch any potential spills.
Bake 55 to 60 minutes, or until the pie is golden brown and the filling is set. Cool completely before serving.