I have been doing some more checking for this behavior.
The very interesting thing is that the Shortcode Scratch is rendered on the local server only in Fast Render mode.
If --disableFastRenderMode
is used then the Scratch is missing even on the first build.
Also the Scratch is not outputted when the project is published with the command hugo
.
P.S. I deleted my previous answer as my assumption was incorrect. The rendering order does not seem to have to do much with it. Since Shortcodes are rendered first I would expect that a Scratch variable set in a Shortcode would be available in the Parent Page.