Combine 2 cups of milk with the sugar and salt in a medium saucepan. Bring the mixture to a simmer over medium heat while stirring occasionally to dissolve the sugar.
While the mixture comes to a simmer add the rest of the milk, egg yolks, cornstarch, and flour to a mixing bowl. Whisk to combine.
Once the milk mixture comes to a simmer, transfer about a cup of it into the egg yolk mixture while constantly whisking. This is to temper the egg mixture so it doesn't turn into a scramble when added to the hot milk.
Now pour the tempered egg yolk mixture into the simmering milk. Whisk constantly until the mixture thickens and begins to bubble.
Remove from the heat and pour the hot pastry cream mixture through a strainer into a bowl set in an ice bath. Use a spatula or wooden spoon to stir and help push the cream through the strainer. Next, stir in the butter and the vanilla extract.
Top the pastry cream with plastic wrap. Make sure the plastic wrap touches the whole top surface of the pastry cream so it will not form a skin. Refrigerate a couple of hours to fully cool down before using in your desserts.