I don’t fully understand what you wrote, but the basic idea would be to use $bean->load_relationship to load the related beans. You might have to do a couple of these, if they are not related between themselves.
Another option is to get a direct SQL query that delivers the results you want and use a subpanel based on that query, see