Preheat the oven to 350°F. Line a light- or medium-colored heavy-weight baking sheet with parchment paper or a silicone baking mat.
Separate the egg: put the yolk in a small bowl and reserve the white in a separate small bowl if you plan to roll cookies in pistachios. Cover and set the reserved egg white aside.
In a large bowl, beat the room-temperature butter and granulated sugar with an electric mixer on medium-high speed until light and fluffy, about 2 to 3 minutes. Scrape down the bowl.
Add the reserved egg yolk, vanilla extract, and optional pistachio extract to the butter mixture and beat until combined.
Sift the all-purpose flour, sifted dutch-processed cocoa powder, and 1/2 teaspoon fine sea salt together into the bowl. Mix on low speed just until the dry ingredients are incorporated and the mixture comes together into a stiff dough. If the dough is very crumbly, continue gently pressing and mixing in the bowl until it holds together into a firm dough.
Using your hands, roll the dough into 1-inch (about 2.5 cm) balls. Arrange the balls on the prepared baking sheet, leaving room for slight puffing.
For plain cookies: flatten each ball slightly with your thumb or the back of a rounded 1/2-teaspoon measuring spoon to create a shallow indentation in the center. Do not press all the way through. If the spoon sticks, dip the back of the spoon lightly in a little of the all-purpose flour before pressing.
For nut-coated cookies (optional): lightly dip each dough ball into the reserved egg white, then roll it between your palms so the egg white forms a thin coating. Roll the coated ball in the coarsely chopped pistachios until evenly covered, place it on the baking sheet, then press an indentation as in step 7. (The recipe provides 1/2 cup chopped pistachios, enough to coat about half the batch; use a full cup if you want to coat all the cookies.)
Bake the cookies for 10 to 12 minutes, until the centers are set and slightly puffed and the edges are slightly darker in color. Remove the baking sheet from the oven.
While the cookies are still warm on the baking sheet, redefine each indentation with the back of the 1/2-teaspoon measuring spoon you used earlier (the centers will have puffed during baking). Allow the cookies to cool on the baking sheet while you prepare the filling.
Make the filling: place the chopped white chocolate in a small microwave-safe bowl. Heat at 50% power in 30-second intervals, stirring between each interval, until the chocolate is fully melted and smooth.
Stir the pistachio butter, sifted powdered sugar, 1/8 teaspoon fine sea salt, optional 1/8 teaspoon pistachio extract, and optional 1/8 teaspoon vanilla powder into the melted white chocolate until smooth and fully combined.
Spoon about 1/2 teaspoon of the filling into the center indentation of each cookie, using slightly more or less as needed to avoid overflowing.
Let the filled cookies set at room temperature for about 2 hours until the centers are no longer shiny, or chill them in the refrigerator for 10 to 15 minutes to speed up setting.
Store the cooled cookies in an airtight container at room temperature or in the refrigerator for up to 5 days.