(BTW: the problematic part was to make it fast enough not to be noticeable. The code that dumps the pane contents and searches for the start of the last output is written in Nim, in effect.)
It was possible in TMUX because it gives you programmatic access to the pane's content. It's probably possible to do the same with some terminals - urxvt uses Perl as an extension language, for example - but TMUX provides a compatibility layer, which means I don't need to rewrite the whole setup if I change the terminal emulator.
However I like the fact that kitty developer(s) actively improved the state of the terminal emulation with their new keyboard and graphic protocols [2].
[0] https://github.com/kovidgoyal/kitty/issues/2481