1. Butter and flour a 9-inch square baking pan.
2. Coarsely chop 3 ounces of the chocolate and place in a microwave-safe bowl. Heat in a microwave oven on full power (100%), stirring every 30 seconds, until melted and smooth, about 1 1/2 minutes total.
3. In a large bowl, with a mixer on medium-high speed, beat 1/2 cup butter and the sugar until fluffy. Add eggs and vanilla and beat until well blended. Stir in melted chocolate.
4. In another bowl, mix 1 1/2 cups flour, baking soda, and salt. Add flour mixture and milk to butter mixture, stir to combine, then beat until well blended. Scrape batter into prepared pan and spread level.
5. Bake in a 350° regular or convection oven until cake begins to pull from pan sides, 40 to 50 minutes. Let cake cool to room temperature in pan on a rack, about 1 1/2 hours.
6. Run a thin knife between cake and pan sides and invert onto a board to release. Cut cake into 1- to 1 1/2-inch cubes. Layer a third of the cubes in the bottom of a 3- to 3 1/2-quart trifle bowl or other straight-sided glass bowl. Drizzle 1/4 cup liqueur evenly over cake. Spoon a third of the Caramel Pastry Cream over cake and spread level. Repeat to make two more layers each of cake, liqueur, and pastry cream, ending with pastry cream. Cover and chill at least 2 hours or up to 1 day.
7. Finely chop remaining 1 ounce chocolate or scrape into curls. Arrange raspberries on trifle and sprinkle chocolate evenly over berries. Scoop onto dessert plates to serve.