Heh, so yeah, that's a really simple solution - that loser Xen would have pointed it out ages ago if he were here.
You can use systemd to hook into system events (like shutdown), so you can create simple service like this one with Before=shutdown.target:
[Unit] Description=/etc/rc.local.shutdown Compatibility Before=shutdown.target [Service] ExecStart=/bin/true ExecStop=/etc/rc.local.shutdown RemainAfterExit=yes [Install] WantedBy=multi-user.target
Where /etc/rc.local.shutdown is a script containing the original echo 0 > /sys/class/backlight/rpi_backlight/bl_power (prepended with #!/bin/bash line) and once you've enabled that service, any time the system is shutdown - whether via Kodi or command line or the button - it triggers the script and turns off the backlight.
/storage/.config/shutdown.sh
case "$1" in halt) # your commands here ;; poweroff) # your commands here ;; reboot) # your commands here ;; *) # your commands here ;; esac