Put oven rack in middle position and preheat oven to 350°F. Butter baking pan, then line bottom with parchment paper and butter paper. Dust pan with flour, knocking out excess.
Pulse together 1/2 cup flour, 1 cup sugar, pistachios, and salt in a food processor until pistachios are very finely ground (mixture will resemble a slightly grainy flour). Transfer mixture to a large bowl and whisk in yolks, milk, and extracts.
Beat egg whites with a pinch of salt using an electric mixer at medium-high speed until they hold soft peaks. Reduce speed to low, then add remaining 1/2 cup sugar, a little at a time. Increase speed to high and beat until whites hold stiff, glossy peaks. Fold one third of whites into batter to lighten, then fold in remaining whites gently but thoroughly.
Pour batter into baking pan, spreading evenly, and rap pan against counter to release any air bubbles. Bake cake until golden and springy to the touch, 20 to 25 minutes.
Cool cake in pan on a rack 20 minutes. Remove pan (with cake) from rack and cover rack with a sheet of parchment, then invert rack over cake and flip cake onto rack. Carefully peel off parchment from bottom of cake and cool completely.
Slide cake (on parchment) onto a work surface and arrange with a long side nearest you. Trim cake with a serrated knife to make a 12- by 9-inch rectangle, reserving trimmings, then brush cake and trimmings with Sherry syrup. Halve cake crosswise, then cut each half into thirds first lengthwise and then crosswise to total 18 (3- by 2-inch) pieces. Halve each piece diagonally to form triangles.
Spoon 1/2 cup custard into bottom of trifle dish. Arrange half of triangles over custard in 2 layers, pressing short ends of triangles against side of dish (there should be small spaces in between slices for custard to run through). Arrange half of trimmings in the center, cutting them as needed to fit. Spread 1 1/2 cups custard over cake, then spread 1 cup rhubarb purée over custard.
Cover with remaining cake and trimmings in same manner, then spread remaining custard over. Spread remaining rhubarb purée over custard, leaving a 1-inch border around edge. Chill, covered tightly with plastic wrap, at least 8 hours.
Make topping just before serving:
Beat cream with sugar and Sherry using cleaned beaters until it just holds soft peaks. Spoon cream over top of trifle, then sprinkle with pistachios.