History has nothing to do with how Maven/Gradle was designed. Situation of Java and JavaScript is actually very similar. They both were created 20+ years ago (in exactly the same year), they both do not provide any package manager and they both have package managers as external tools: yarn, npm, etc. for JS and Maven, Gradle, Ivy for Java/Kotlin.
I guess it would be even possible to port npm or yarn to Java with almost the same usage specifics, but nobody would use it, because there is Maven/Gradle.