This works as expected:
<?php
$resources = $modx->getCollection('modResource', array('context_key' => 'web'));
$tplContent = '<a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+menutitle:default=`[[+longtitle]]`]]</a>';
$output = array();
foreach ($resources as $resource) {
$tpl = $modx->newObject('modChunk');
$tpl->setCacheable(false);
$output[] = $tpl->process($resource->toArray(), $tplContent);
}
return implode("\n", $output);
?>
You were reusing the same object and it appears it is being cached on the first run; if you would enter a ticket for that, we can make this more efficient by resolving that as a bug.