Fixup CacheManager target filtering to be less-narrow

The root targets to check should be those with sources (and possibly dependencies).
This fixes an always-valid issue with new-style Resources.