ww-run-raise more or less solved that issue, exactly by using kwin scripts. However since kde 6 it seems the ‘workspace’ variable is no longer exposed to scripts, making it rather difficult to get window information from kwin (unless I’m missing something).
This has also been mentioned in KWin Scripting not exposing signals as documented (eg. clientAdded) and reported in bug 485718. So far I haven’t seen a solution.