Whisk sugar, flour, and salt together in a saucepan over medium heat. Add milk and cook, whisking constantly, until mixture thickens and begins to bubble, 3 to 5 minutes. Remove from heat.
Stir pineapple, egg yolks, and butter into milk mixture. Return to heat and cook over medium heat until mixture begins to bubble, 3 to 5 minutes. Continue cooking, stirring constantly, until hot and thick, about 2 minutes more. Pour mixture into prepared pie crust. Refrigerate until chilled, at least 3 hours.