In a medium saucepan, whisk together the sugar, flour, and salt until evenly combined.
Gradually whisk in the milk until the mixture is smooth. Add the unsweetened chocolate squares (break into pieces if needed) to the saucepan.
Place the saucepan over medium heat and cook, stirring constantly, until the mixture comes to a full simmer and begins to bubble; continue cooking and stirring for 2 minutes.
Remove the pan from the heat. To temper the eggs, slowly whisk a small amount of the hot chocolate mixture into the beaten egg yolks, stirring constantly, until the yolks are warmed.
Immediately pour the warmed yolks back into the saucepan, return the pan to medium-low heat, and cook, stirring constantly, for 2 minutes.
Remove the pan from the heat. Stir in the butter and vanilla until the butter is melted and incorporated.
Add the cream cheese (cut into small pieces) and stir until the filling is smooth and the cream cheese is fully incorporated.
Pour the hot filling into the cooled baked pie shell. Let the pie cool to room temperature, then refrigerate until fully set before slicing.