[Caching] Do not update file if the same when cache replay
Make sure cache replay matches the same behavior as normal compilation
that the output is not written (timestamp preserved) when replaying
cache hits. This make sure the downstream dependencies are not
invalidated on a cache hit but the output doesn't change.