Based on the data we have in usage tracking we can (not completely, but close enough) reproduce what resources will be loaded from the repo, thus we can preload these in one go.
This has been discussed before and I just looked into this again, thinking it was easy to implement and could probably save us some time on page rendering as entity usage barely (fundamentally) changes.
One way to do this would be to have a central service which individual prefetchers can sign up with for prefetching. The downside of that is, that it will probably require quite some abstraction (I didn't yet think of an exact design, but I guess we would need to have at very least one extra class per type of prefetcher and an interface). Also it seems difficult to pass the state (the cached data) between that service and the actual users, especially given the many places we use instantiate term lookups during page rendering right now (for the parser function and Lua).
We need to keep in mind that we potentially have labels in many languages in usage tracking (on multilingual wikis), but that shouldn't be an issue here, as we can just preload the labels for the language we are needing a label description lookup for (as these are limited to one language and are either the content language or the user language).
Also we might want to not do that at all, should we decide to drop usage tracking based on MySQL tables?