the basic idea is quite simple to implement. it simply entails creating a custom npc that hurts you and then (i assume to mimic powerup behavior) also kills itself when it does so. the main problem here is implementing the tanooki leaf movement. since it's a legacy NPC, there's no ready-made lua script with it's AI, but luckily since the SMBX source code is now public, it's possible to simply view
exactly how it's physics work and attempt to recreate it based on that.
alternatively, you could just make it so that leaves are by default invisible and draw over the ones you actually want to be visible with the normal sprite, then have an (effectively) invisible, friendly tanooki leaf that you manually set never to despawn (field
despawnTimer) and just have your custom NPC follow it's movements with a specifed positional offset based on it's initial spawn point.
i'm aware that both of these solutions seem a bit daunting, but they're the only ones that come to mind for me. someone else might have a better idea.