Make the filling: Place all the filling ingredients into a medium saucepan. Turn heat to medium and cook for 15-20 minutes until reduced and thick. Keep an eye on it and stir continuously with a rubber spatula. Transfer to a bowl and refrigerate while you make the pastry.
Make the pastry: Add melted coconut oil, sugar, and 1 egg to a large bowl. Whisk together.
Add the flour, baking powder, xanthan gum, and salt to the same bowl. Use a whisk or fork to gently swirl the dry ingredients together on top, then switch to a spatula and mix to fully incorporate the dough together. It may also be easier to use your hands. Add water by the teaspoon if the dough is a bit crumbly. It should be smooth and soft. Form into a ball.
Once the dough is formed, preheat the oven to 375°F. Line a large baking sheet with parchment paper. Cut 2 additional pieces of parchment paper, about the size of your baking sheet.
Place the dough ball in between the 2 pieces of parchment paper. Use a rolling pin on top of the parchment to roll the dough to ⅛-inch thickness. It should be slightly see-through but still thick enough to handle without ripping. Use a sharp knife or pizza cutter to slice into 3x4-inch rectangles. You may have to re-form the scraps and roll again. You will need 12 rectangles total. Place 6 on the parchment-lined baking sheet with space between them.
Assemble: Place 1 tablespoon of chilled blueberry filling in the middle of each of the 6 rectangles, leaving a border of empty dough around the outside. Dip a finger in water and run it around the edges of the rectangles to help the top dough stick.
Place the other 6 pieces of dough on top of each of the filled pastries. Crimp the edges all the way around by pressing with a fork to seal the dough. Stab the top of each pastry twice with the fork as an air release.
Whisk the second egg in a bowl. Brush the egg wash on the tops of the pastries. Bake for 20 minutes, until golden.
Mix powdered sugar and milk in a small bowl and set aside. Allow pastries to cool on the baking sheet. After 10 minutes, place a tablespoon of icing on top of each pastry. The heat will help it to melt and spread. Top with sprinkles or coarse sugar, if desired. Enjoy warm.
Note: Finished pastries can be stored in an airtight container in the fridge for up to 3 days, or in the freezer for 2 months. To reheat, pop in the toaster or bake at 400ºF for 5-6 minutes.