Hello,
On terminal supporting palette changes, Kakoune touches the palette to set-up color schemes (on other terminals, it approximates the colors requested according to what it believes to be the default palette).
In order to avoid leaving the terminal with a strange palette, on exit it emits an escape sequence to tell the terminal to reset its palette, leading to what you experienced (terminal palette being reset to default after running Kakoune).
Using a KakEnd hook is a good idea there, but will only work on the server process (if you just run one Kakoune client/server process, then you are fine, but if you connect to an existing session with kak -c <session>, KakEnd will not help as you would want that palette restoring code to run on the client terminal.