Preheat oven: Preheat your oven to 350°F (175°C). Line a muffin tin with cupcake liners.
Prepare the cupcake batter: In a bowl, whisk together flour, baking powder, and salt. In another bowl, cream butter and sugar until fluffy. Add eggs one at a time, followed by vanilla. Gradually add dry ingredients, alternating with milk, until just combined.
Bake the cupcakes: Fill cupcake liners about 2/3 full. Bake for 18–20 minutes, or until a toothpick inserted in the center comes out clean. Cool completely on a wire rack.
Make the custard filling: Heat milk in a saucepan over medium heat until just steaming. In a bowl, whisk egg yolks, sugar, and cornstarch. Gradually add hot milk to the egg mixture, whisking constantly. Return the mixture to the saucepan and cook over medium heat until thickened. Remove from heat and stir in vanilla. Let cool completely.
Prepare the ganache: Heat heavy cream in a small saucepan until steaming (do not boil). Pour over chopped chocolate and let sit for 2 minutes. Stir until smooth and glossy.
Assemble the cupcakes: Using a knife or a cupcake corer, cut out a small hole in the center of each cupcake. Fill with custard using a piping bag or small spoon. Replace the top of the cupcake (trimming if needed).
Top with ganache: Spoon or dip the tops of the cupcakes into the chocolate ganache. Let set at room temperature or in the refrigerator for a few minutes.