Cannot determine why Gradle downloads compileClasspath dependencies at configuration phase

From reading how to improve Gradle build performance, I understand that dependencies should not be downloaded in configuration phase.

I am using remote build cache always running builds from scratch in empty Docker container.

My build always downloads all dependencies for :compileClasspath even if :compileJava task is taken from build cache.

I was under impression that Gradle would now download dependencies if :compileJava is already in cache and there is no need for its execution.

Here is sample build.gradle

plugins {
    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    def springBootVersion = '2.4.2'

    implementation "org.springframework.boot:spring-boot-starter:$springBootVersion"
}

Having very little experience with the build cache, here’s my guess; the compile classpath is an input to the compileJava task, so the dependencies are part of the task’s cache key and therefore need to be downloaded in order to perform the key calculation.

the dependencies are part of the task’s cache key and therefore need to be downloaded in order to perform the key calculation

Yep, that makes sense to me also