There are lits of external factors like costs, available support, availability of compilers for certain hardware, support of the existing tool chain, learning curve, career chances etc.
Python and JavaScript aren't the best but sufficient enough
This isn't true. Sure, you can't unilaterally pick whatever language you want when you work with other people. But for every piece of software ever built somebody had to decide what to build it with. And even though Julia has existed for 10 years, almost nobody is picking it over the alternatives.
Java started with a first implementation in 1991, but I didn't find it usable for serious production until about 1999-2000. That isn't quite 10 years.
10 years from inception to mature-enough-for-production seems to be kind of the rule. Building support systems and a community is hard, hard work.
You need to gather a certain critical mass of users to get popular. Otherwise Java , JavaScript or Python would have been replaced already.
Most of the time accessibility beats performance.
What do you think why Visual Basic was so popular and why Python is now?
It might not be a perfect relationship - there will be lagging effects and other factors, it will vary based on the specific task, and some of it will be subjective - but you can’t pretend that there is no relationship at all.