An event can be captured and released in the same event handler, before
the last_listener_index would have been updated. This causes some handlers
to be triggered multiple times.
The solution is to update the last_listener_index before calling the next
event handler, so capturing and releasing within an event handler is harmless.
Also see discussion at
https://github.com/zmkfirmware/zmk/pull/1401