Make the topping
Butter a 9-inch square cake pan. Line the bottom with parchment and butter the parchment.
Put the butter and sugar in a 2-quart saucepan and cook over medium-low heat, stirring occasionally, until the sugar is dissolved and a shade darker, about 3 minutes. Remove from the heat, and add the rum (be careful; it will bubble and steam). Return the pan to the heat and stir until combined, about 30 seconds. Immediately pour the caramel into the cake pan, spreading it with a spatula to cover the bottom. Let sit until cool enough to touch, about 5 minutes.
Decoratively arrange the mango and pineapple over the caramel, overlapping the pieces slightly.
Make the cake
Position a rack in the center of the oven and heat the oven to 350°F.
Combine the flour, baking powder, and salt in a medium bowl.
In a stand mixer fitted with the paddle attachment (or in a large bowl using a handheld electric mixer), beat the butter and granulated sugar on medium speed until light and fluffy, 3 to 5 minutes. Add the rum, zest, and vanilla, and then the eggs, one at a time, beating well after each addition.
With the mixer on low speed, alternately add the flour (in 3 additions) and the coconut milk (in 2 additions), beginning and ending with the flour, and beating until just combined after each addition. Stir in the shredded coconut.
With a spatula, gently scrape the batter into the prepared cake pan without disturbing the fruit. Smooth the surface. Tap the pan firmly against the counter once or twice to remove any air bubbles. Bake, rotating halfway through, until a tester inserted in the center of the cake comes out clean, 40 to 50 minutes.
Cool on a rack for 20 minutes. Run a knife around the edge of the cake to release it from the pan and invert it onto a serving plate. Remove the pan, and rearrange any fruit that has stuck to the parchment. Serve warm or at room temperature.