The docs say:
At deployment, before starting your application, you can perform a custom build step by adding a gcp-build script in your package.json file.
"At deployment" makes me think it runs it when you run gcloud app deploy
- but some of the rest of the page makes it sound like it's run when each instance is started.
The custom built step will be executed when each instance is created.
The deploy includes the end to end process, meaning it starts by gathering your code/scripts, creating instances and customization, which is the build step and sending your code to the instances.
This doc can give you more details on this specific command