Gradle confusing Java modules with Gradle Projects

I am creating a Java 11 project and have it similarly structured to the OpenJDK however when trying to build, reload, run in IJ etc. the compilation throws this error(Of course the ‘PATH_TO_PROJECT’ is just the full path to my project):

Project directory 'PATH_TO_PROJECT/src/module1' is not part of the build defined by settings file 'PATH_TO_PROJECT/settings.gradle'. If this is an unrelated build, it must have its own settings file.

Adding the settings.gradle to the complained about directory causes gradle to misconfigure the module path(or something along those lines) and then the modules stop being able to use each other. For example having a base module that requires an api module might stop working when a settings.gradle is added to either.

I have also tried adding a build.gradle to the directory and then including it in the root settings file but this doesn’t seem to make a difference and i still get the same error.

Here is any relevant info like my build.gradle or project structure.

This now seems to be a IJ bug as using Gradle through the terminal works completely fine(besides some minor issues)