Yes, that is expected as the suggested line
write('PATH="${RTOOLS40_HOME}\\usr\\bin;${RTOOLS40_HOME}\\mingw64\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)
adds the Rtools folders in your path only when running R and not otherwise. If you would want to run mingw32-make in the PowerShell you would have to add this to the PATH of Windows.
But if you will only use cmdstan via cmdstanr then this is not required.