Don't overwrite cache timestamp until after build has been compiled and saved.

I am using asset compress build_ini task on our live server in our deploy script, but was having problems because the build timestamp cache file was being overwritten before the compiled file was generated, which caused visitors to get 404 errors when visiting the site, which were then cached on our CDN causing problems for everyone.
Wouldn't you still have the 404 issue while the file was being built then? If the build timestamp is set to zero, then the file is rebuilt, then then timestamp is updated, I would expect that during the build window you could still hit a 404, but I might be misunderstanding or misremembering how things work.