This shouldn't be needed since Qt is built without High-DPI scaling support in official binaries and QT_SCALE_FACTOR is a debug environment variable, so any use of it is a user's environment misconfiguration.
https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference
At least Kvantum makes QGuiApplication constructor to call QGuiApplication::devicePixelRatio, so the value is cached and won't change.
Resetting the cache fixes the issue.