I think it's at least five elements:

1. Hacker-tinkerer culture, where you want to build new things that haven't been built on new hardware for fundamentally non-commercial reasons. This could be called Carmack-style hacker culture in my mind, which produced Quake.

2. Genuinely extensive programming expertise.

3. Not partaking in the current and quite toxic VC-funded game development culture, where funding dictates rushed deliverables (through schedules, and the constant race to attract funding with demos). It's feature factory or die in a lot of VC-funded scale-ups.

4. Lucky circumstances - knowing someone who could get you Quake source on "just have it, we'll work something out eventually" terms back then was exceptionally lucky. Quake was very far ahead of it's time. Most companies that produce such work now would work very hard to make sure no one else gets it. And that goes back to the hacker culture of just building cool things to share with people that was more common in games then.

5. Time - the games industry was young, before Quake there were no proper 6 DoF generalist 3D game engines, so it was an auspicious time for game development.

I'm a game developer and I am a bit old school, so I'm not the best person to speculate on why JavaScript programmers seem less able to build cool tech. But I have seen many young people approach programming differently now, probably because it has become a lot more commodified. The mindset of a "clock-in clock-out" programmer wasn't common in game circles in the 90s and 00s. Also, there was much less focus on using "correct" idioms and beautiful code as the end goal in hacker circles, and a lot more focus on building something that others haven't built before and working out the details later. Moreover, business viability was rarely the first thing you would think about and work backwards from when you worked on a game project. Business success was a byproduct of building cool games.

If you would remember game trailers from early 00s, like Half-Life 2 (since we are talking about Valve), you would pick up that they show off cool tech like physics simulation, which is quite janky and imperfect. Carmack also has spoken many times about how in his early games (pre-Quake) the graphics would initially be quite bad and he would be worried about getting everything fixed in time. Cool over safe, cool over perfect, and showing off cool things that were not polished was normal.

Nowadays, things are different in some ways. The game development has become methodical and focused on the exploitation of passion for money in a repeatable way. You get as many features as you can for marketing (you only need to have them, they can be whatever quality, it's only for the Steam page and trailer). You cut all the awesome new things as they are a risky waste of money, you instead funnel all the passion into velocity for delivering that bundle of features as quickly as possible for as cheap as possible, and that's it. If you can strike a deal with a nice IP, that will make the game sell a lot more. So will striking a deal with a publisher with deep pockets for marketing. But the "do cool things" hacker culture is gone in AAA and blockbuster games. It's now relegated to indies where quite a lot of janky but incredibly cool games are made. But they have a funding access problem as their business is too risky for most publishers and VCs. And that's probably why we don't see many new and big id and Valve-type companies anymore.

Although with VR, there are some companies that I believe could be like that. And they attract senior talent quite well. With the right management and timing, I think we could see another Valve in VR. Even Carmack played a big role in VR until recently, before he moved on to the next new thing in tech. Being on the precipice of new tech is important for people of that culture.