NODE_ENV is only relevant in the context of Sage when running the build process–it doesn’t have anything to do with your WP_ENV. It will be set to “production” when you run build: production (as opposed to build) unless you’ve modified that command in your package.json.
Not sure why there would be documentation about NODE_ENV in the Bedrock docs. It doesn’t have anything to do w/ Bedrock. It’s just an environment variable that you can set, or not, and it’s only going to be relevant (generally) to JS scripts run from the command line. In Sage 10 it’s set explicitly whereas Sage 9 doesn’t seem to use it directly instead appearing to use Webpack’s env CLI arguments. I don’t know which version of Sage you’re using, or where the code snippet you posted is being used, but you should be able to adapt either approach to work for you.