It's a matter of design and can vary depending on how you wish to approach it.
Basically, you want to avoid making queries, so your focus would be to investigate ways of:
a) reducing queries, or
b) completely eliminating them
(looking at your code, you may be performing multiple queries whenever there's multiple forums to display, making (a) viable)
Note that you can't generate data from nothing, so it ultimately probably will come from a query, meaning that you should focus on reducing queries. (b) may be possible if we can leverage existing MyBB queries (ie piggy back our data on them).
So what's causing all the queries?
So for every forum, you're pulling a thread and a user (potentially 2 queries, depending on how MyBB manages to cache it).
One idea which may come to mind is to pull all needed threads and users in a single query, cache the result, then serve from there, eg:
The above simple modification caches the result so you don't need to perform multiple queries (only 2 queries total on every page). However, it requires you knowing all the threads and users before making it.
(b) may be possible to do here as well. MyBB caches information about the last post already, so take a look how it does that, and just extend it to include caching the avatar.
Note that this is a cache-on-update type behaviour, which means you'll have to patch (or trigger on) routines which potentially cause post updates. That is, you'll probably need to hook into newpost, newthread, deletepost, mergepost etc routines to ensure the cache is updated.
This method is much more difficult, but probably is the best in this situation.