Make the pastry cream first. In a saucepan, heat the milk until steaming.
In a bowl, whisk sugar, egg yolks, cornstarch, and a pinch of salt until smooth. Slowly whisk in the hot milk to temper, then pour back into the saucepan. Cook over medium heat, whisking constantly, until thick bubbles form and it’s pudding-like, 1–3 minutes.
Remove from heat and whisk in butter and vanilla.
Chill the pastry cream. Transfer to a shallow bowl, press plastic wrap directly on the surface, and chill at least 2 hours, or until firm and cold. This helps it slice cleanly.
Prep the pans and oven. Heat oven to 350°F (175°C). Grease and flour two 9-inch pans, or line bottoms with parchment.
If using one pan, ensure it’s tall enough and line well for easy removal.
Mix the cake batter. In a large bowl, whisk flour, baking powder, and salt. In another bowl, beat butter and sugar until fluffy, 2–3 minutes. Add eggs one at a time, then vanilla.
Add dry ingredients alternately with milk, beginning and ending with dry, mixing just until combined.
Bake the cakes. Divide batter between pans and smooth the tops. Bake 20–25 minutes, until a toothpick comes out clean and tops spring back. Cool 10 minutes, then turn out onto a rack to cool completely.
If you baked one cake, cool fully and carefully slice horizontally to make two layers.
Make the ganache. Place chopped chocolate in a heatproof bowl. Heat cream until just simmering, then pour it over the chocolate. Let sit 2 minutes, then stir from the center outward until smooth.
Add butter and a pinch of salt for shine and balance. Let cool 10–15 minutes until thick but pourable.
Assemble. Place one cake layer on a serving plate. Stir the chilled pastry cream to loosen slightly, then spread it evenly, leaving a 1/2-inch border.
Top with the second cake layer. Press gently to settle.
Glaze with ganache. Pour ganache over the top and nudge it toward the edges so it drips just slightly. You want a glossy cap, not a full coat.
Let set at room temperature 20–30 minutes, or chill briefly to firm.
Rest before slicing. For the cleanest slices, chill 1 hour before cutting. Run a warm knife through each slice and wipe between cuts.