Set aside a bowl with a fine-mesh sieve.
In another bowl, whisk together cornstarch and sugar, then add eggs and whisk until smooth.
In a saucepan, heat milk, salt, and vanilla over medium-high until just below boiling. Stir frequently.
Gradually whisk 1/3 of the hot milk into the egg mixture, then combine with the remaining hot milk. Cook over medium heat, whisking constantly, until thickened and just boiling.
Strain the mixture through the sieve into a bowl.
Add chocolate and stir until melted, then add butter one tablespoon at a time until smooth. Let cool for 10 minutes.
Pour the pastry cream into the chocolate and caramel-lined crust. Press plastic wrap onto the surface and chill for at least 4 hours, preferably overnight.