The npm preinstall script is not run when a custom Node version is defined via the NODE_VERSION env variable or via the .nvmrc file (or at least with 16.14.0 LTS version).
Our use case is a private Github repository dependency (we followed the Managing multiple environments docs) + a requirement to run another Node version than the default one. As a workaround we appended the .npmrc file directly to the repository root, but that breaks our local development.
So Cloudflare Pages is working as expected, but maybe a note in the documentation could be added that the preinstall workaround does not work with npm >= v7.
A nice feature for this would be to add a special env variable (e.g. NPMRC) that would populate the .npmrc file with the variable content or some other way to run a script before everything else.