This error isn't about storing or restoring caching results. Afaik no cache report is produced, because the build fails during the configuration phase.
This issue in a nutshell: when configuring project for the "release" built type, somehow also the "debug" modules are being accessed. And because "configuration on demand" is enabled, those modules are not configured properly, so an exception is thrown.
I will try to removing the line you mentioned. But from my understanding, this is needed to configure the plugin tasks for all dependent modules. I will let you know the results