This is really weird to end up moving such code to a "utils" file.
It is full of very important code that is all but runtime-specific code.
We should keep this code in copy-build-stage-data.js.
Only the runtime specific code like copyTo should be abstracted in utils.
(Keep in mind you can do the nodejs/utils refactoring in another patch!)