Ran into this exact same issue. Uninstalled eclipse/my jdk/even tried things like deleting .minecraft and reinstalling forge.
What I noticed is that whenever I ran ./gradlew genEclipseRuns it was building ~very~ fast, so I downloaded another version of the sourceForge mdk and rebuilt and it worked.
I went with mdk 31.1.30, because my second guess was that this might be a new uncaught bug.
But my guess is that it just has to be a different version, so maybe 31.1.48 or something.
My guess is there is something being cached by gradle for that initial eclipse build from the newer java version.
Maybe a faster way to fix this can be done by looking into ...\.gradle\caches and deleting forge related caches.