Composed build error: Cannot change dependencies of dependency configuration after it has been included in dependency resolution

Hello,

I have following composing builds:

+ root
|- platform // composed build
|-- plugins // composed build with Gradle plugins
|--- install-app // Gradle plugin that installs `app`
|-- app // Project that builds an app
|-- tool // Project that installs an app with the plugin
|- product // composed build
|-- integration // Project that installs an app with the plugin

There are two root projects platform and product that are included builds.
The platform project has plugins as included build whereas plugins contains my gradle plugins.
The install-app plugin looks up for app project, then resolves artifacts to get path to app binary.
The tool project applies the plugin to have the app installed.
The product project uses platform and platform/plugins as included builds.
The product/integration project also applies the plugin to have the app installed.

All projects use Kotlin and Android plugins.

The plugin resolves artifacts using a detached configuration:

project.configurations.detachedConfiguration().apply {
  isTransitive = false
  isCanBeResolved = true
  isCanBeConsumed = false
  isVisible = false
  dependencies.add(project.dependencies.create(project.resolve(TESTING_SUPPORT_MODULE)))
}.incoming.artifactView {
  attributes.attribute(Attribute.of("artifactType", String::class.java), "apk")
}.files

where project.resolve is custom method that can return either project :local_project or group:name:version string, depending on some external flag.

Then the plugin is applied either in platform/tool or product/integration then the path is resolved correctly.
If the plugin is applied in both projects, it resolves path for the first project, but fails to do it for the second due to

 Could not resolve all dependencies for configuration ':product:integration:detachedConfiguration3'.
   > Cannot change dependencies of dependency configuration ':platform:app:api' after it has been included in dependency resolution.

I tracked it down to the kotlin plugin that tries to add default std dependencies, source.

As I can get, there is some default action that Kotlin plugin add to any configuration. And Kotlin plugin consider :app and :platform:app as different projects. But Gradle seems to know that they are the same.

Is there any other way to resolve path to artifact of app project both from the same root project and from composed build?
Is there a way to tell Kotlin plugin to not update dependencies for the project of included build?

------------------------------------------------------------
Gradle 7.1
------------------------------------------------------------

Build time:   2021-06-14 14:47:26 UTC
Revision:     989ccc9952b140ee6ab88870e8a12f1b2998369e

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.11 (Ubuntu 11.0.11+9-Ubuntu-0ubuntu2)
OS:           Linux 5.11.0-31-generic amd64

Thank you.