Will all your .tooltip dom elements be static and available when the rawMarkup script runs? The way you have the code, this will run just once:
var ktooltips = document.querySelectorAll(".tooltip");
Any new DOM elements which come after will not be picked up automatically.
If you want to make it dynamic, then it might work to register a th-page-refreshed hook by calling $tw.hooks.addHook
Change your main code into a function and register that with the addHook call. IOW, put this code into a function:
Instead of tagging the tiddler as RawMarkup, you can set the module-type field to 'startup'.
One worry I have is that your code will be called on every refresh and the call to addEventListener will happen on every matching dom element every time. You should research that method to see if your event listeners will continually accumulate (i.e. getting added over and over until the dom element goes away). If that is the case, then you would probably want some way to avoid adding the listener multiple times.
I've never used the tw addHook...just sharing in case it helps you. Also, this solution altogether seems a little "hacky" and not really in line with the tiddlywiki-way.
Here is a link to documentation for addHook and startup modules: