Combine the finely chopped rosemary, flour, sugar, and salt in the bowl of a food processor, and pulse briefly until everything is well-blended. Add the cold cubed butter and pulse until it is in small pea-sized pieces. Add the egg yolk and pulse in long 5-second bursts until the dough starts clumping together.
Turn the dough out of the food processor and knead it lightly several times to incorporate any extra flour. At this point, the dough can be wrapped and refrigerated for several days. If you’re ready to use it now, spray a 9-inch tart pan with a removable bottom with nonstick cooking spray. Press the dough into the bottom and sides of the pan in an even layer. Freeze the shell for 30 minutes, and while it’s the freezer, preheat the oven to 375 degrees F.
Spray the top of the tart dough with nonstick spray, then press a sheet of foil into the shell, shiny side down, and fill the foil with dry beans, rice, or pie weights. Bake the shell for 20 minutes, until the sides start to take on a little color and the center no longer looks raw, then carefully remove the foil and weights.
Bake for an additional 14-15 minutes, until the shell is golden brown. You might want to cover the sides with foil to prevent them from getting too dark. Let the shell cool completely before filling it.
To Make the Pistachio Pastry Cream:
Place the egg yolks in a medium bowl and whisk them briefly to break them up. Combine the milk, sugar, salt, and corn starch in a medium saucepan over medium heat. Whisk everything together, until the sugar and cornstarch dissolve, and continue to whisk while the mixture heats up. Once it starts to bubble and thicken, remove it from the heat. Whisk the bowl of egg yolks while slowly streaming in about 1 cup of the hot milk mixture—this will help heat the egg yolks gently so that they don’t cook during the process.
Now whisk the milk mixture while you pour the egg yolks into the saucepan. Return the pan to the heat and continue to cook, whisking constantly, until the pastry cream thickens and has the texture of pudding. You may want to occasionally scrape the bottom of the pan with a rubber spatula to prevent any scorching. Once thick, remove the pan from the heat.
Stir in the vanilla extract, almond extract, and a drop or two of green food coloring, if you're using it. (The coloring is completely optional, but you might prefer it if you’re used to your pistachio desserts looking green.) Pour it into a bowl or airtight container, press cling wrap right on top of the pastry cream, and refrigerate until thick and chilled. (To speed up the chilling process, you can spread it into a thin layer on a baking sheet and press cling wrap on top.) Pastry cream can be made in advance and kept in the refrigerator for up to a week. Before you use it, fold in the coarsely chopped pistachios. Adding them at the last minute will help prevent them from getting soft or soggy.
To Make the Poached Pears:
Use a vegetable peeler to remove the outer yellow layer of peel from the lemon, and cut it into strips. Use a sharp paring knife to cut a slit in the vanilla bean lengthwise, and spread the bean open. Scrape out the seeds. Combine the lemon peel, vanilla seeds, scraped vanilla bean pod, water, and sugar in a large saucepan over medium heat. Stir occasionally until the sugar dissolves.
Add the pears to the water. Cut a piece of parchment paper into a round circle to fit the top of the pan, and press the paper down on the pears. (This helps prevent them from discoloring when the tops are exposed to air.) Partially cover the pan with a lid, and simmer the pears over medium-low heat until they are soft, for about 20-25 minutes. Turn them occasionally so they poach evenly on all sides.
Once the pears are tender, remove the pan from the heat. Carefully transfer them to a bowl and pour the poaching liquid on top of them. Let them cool to room temperature before proceeding. They can be refrigerated to speed up the cooling process. The pears can be made in advance and kept, well covered, in the refrigerator for up to a week.
To prepare them, cut the pears in half lengthwise, and use a paring knife to remove the stem and seeds from the middle. Cut the pear into long slices, and set them on layers of paper towel. Blot gently to remove excess moisture, so they don’t make the tart soggy.
To assemble the tart, spread the pistachio pastry cream in an even layer on the fully cooked and cooled tart shell. Top with the poached pear slices, slightly overlapping them and arranging them in concentric circles. (Depending on your design, you may not use all of the pear slices.) Finish the tart with a handful of chopped pistachios and a spring of rosemary. This tart is best enjoyed the day it is assembled, but it can be kept, well-wrapped, in the refrigerator for several days.
Recipe Notes: This recipe calls for poaching the pears, but if you have very soft, ripe pears, and if you like the texture of fresh pears, you can skip the poaching step and simply serve the tart with peeled, sliced ripe pears on top. If you do this, consider tossing the slices in a bit of lemon juice to prevent browning.