as i understand it, what you are doing is:
1. request unattended tempate.
2. as foreman generate the request, it parse the template, and see there is media_get_content method which make an HTTP call to foreman again, in order to include that content.

I would assume that 2 can be replaced with content which is stored as a snippet, and we don't need all of the extra roundtrips?