Another alternative that doesn’t depend on the sequencing guarantees made or more often not made by Elm’s libraries — for example, animation-frame says that it generates messages in lockstep with the browser rendering but does not say whether your app will get to process the message before or after the corresponding render — is to do all of this in JavaScript. There are a variety of ways from JavaScript, some more skanky but possibly more performant than others, of watching for when DOM elements are created and triggering code. So, if you can set up something that watches for when your root element is created, you have your hook. Whether you want to deal with Elm sequencing ambiguity or what can feel like hacks in JavaScript is a call you need to make.
Mark
P.S. This is what I use. It feels super skanky since it triggers off of CSS animations but it works. It would be nice to know that such tricks aren’t needed in 2018 (this was written in 2012), but I haven’t see a reference to a definitive, performant method of catching DOM node creation in modern browsers. https://davidwalsh.name/detect-node-insertion