It makes sense that it works in the one-liner because you are not really “exporting” an ENVAR but running it in line as a part of the command. If you run any other command in the step the ENVAR will be gone since we run each step in a new shell.
I agree that we should make this clear because it is a common source of confusion and frustration.
Documentation hints that the following 2 scenarios should be equally treated