In your medium saucepan, whisk together 1 cup sugar, 1/2 cup all-purpose flour, and 1/4 teaspoon salt. This dry mix will thicken and sweeten our custard filling evenly.
Slowly whisk in the 2 cups of milk, making sure to dissolve the flour mixture fully. Chop the 2 ounces of unsweetened chocolate into small pieces and add them to the saucepan. Warm the mixture over medium heat, stirring constantly until the chocolate melts and the custard begins to thicken. This usually takes about 5-7 minutes.
In a separate bowl, lightly beat the 3 egg yolks. To avoid scrambling, gradually pour about half a cup of the hot chocolate mixture into the yolks while whisking continuously. Then, slowly pour the tempered yolks back into the saucepan, stirring constantly.
Continue cooking the custard over medium heat, stirring constantly, until it thickens to a pudding-like consistency. This step usually takes another 2-3 minutes. Remove from heat immediately to prevent curdling.
While the custard is still hot, stir in 2 tablespoons butter, 3 ounces cream cheese (softened), and 1 teaspoon vanilla extract. Whisk vigorously until the mixture is smooth and glossy.
Pour the luscious chocolate filling into your prebaked pie shell, spreading it evenly. Cover the pie with plastic wrap, pressing it directly onto the surface to prevent a skin from forming. Refrigerate for at least 4 hours or overnight until fully set.
Once chilled and set, slice your Homemade Chocolate Cream Pie and serve as is or topped with freshly whipped cream or chocolate shavings for an extra special touch.