It flickers for longer than what the timeout is set to, which makes me think that it takes a split second for the extension to run. But no, I couldn't figure out a better way to get it to fire than wrapping it in a timeout :( An event listener for DOMContentLoaded didn't do the trick either.
For those who want to try on firefox:
1. clone the repo
2. about:debugging. Load temporary -> select any file in repo
BTW, did you not figure any other way other than setTimeout() ? There is a flicker because of that.