Place sugar, flour, and salt into a medium saucepan. Whisk to combine.
Add milk and vanilla, stir to combine. Cook over medium heat, stirring constantly, until the mixture boils. Continue cooking while stirring constantly for 1-2 more minutes until the mixture thickens to a pudding-like consistency. Remove from heat.
Pour into a bowl and place plastic wrap directly on top of to prevent a skin from forming.
Cool to room temperature.*
Using a stand mixer or hand mixer, beat the (room temperature) butter on high until pale and fluffy (3 mins).
Add the (room temperature) pudding mixture 1 Tbsp at a time, incorporating well after each addition. Add other flavoring (optional). Beat for 2-3mins until smooth and fluffy.
Store in an airtight container in the fridge for 1 week or freeze for up to 3 months. Allow buttercream to come to room temperature and rewhip before use.
