refactor(loader): deduplicate S3 get logic in upsertS3CacheEntry