Preheat oven to 350°F. Grease a 9x13 cake pan and set aside.
In a medium bowl, whisk the flour, baking powder, baking soda, and salt together. Set aside.
Using a hand mixer or a stand mixer fitted with the paddle attachment, cream the butter with the sugar until smooth. Mix in the yogurt, crushed pineapple, vanilla, and rum extract.
Add the dry ingredients to the wet ingredients in thirds, alternating with the milk. Be sure to start and end with the dry mix, mixing on low speed between each addition. Beat until just combined.
Transfer the batter to the greased cake pan and spread into an even layer. Bake for 35-40 minutes, or until a toothpick inserted into the center of the cake comes out clean. Cool completely before frosting.
To make the buttercream frosting:
Using a hand mixer or a stand mixer fitted with the paddle attachment, beat the butter until creamy, about 5 minutes.
Gradually add in the powdered sugar while continuing to mix on low speed. Add the milk, one tablespoon at a time, until you have the desired consistency. Beat for another 5 minutes. Spread an even layer onto the cooled cake and sprinkle toasted coconut flakes on top.
Notes
To toast the coconut flakes, spread an even layer on a parchment-lined baking sheet. Toast in the oven at 350°F for 5 minutes. You can use sweetened or unsweetened coconut. I use unsweetened flakes.