Re "Because it seems the US likes technology plenty"
Playing computer games and slowly upgrading to faster broadband is not really the funded thinking production, educational side.
Re: "US R&D centers, and many of them have a lot of US production."
Mostly for branding, per state and federal tax breaks, historical, top level US security clearances, past unique gov funded educational excellence.
Re "mainstay in virtually every segment of software"
Who is sitting next to the emerging generation of US students soaking up the same educational decades? Getting US post graduate positions and learning even more per university, every year? Foreign paying or paid for students are soaking up what made the US unique for free and then returning home as smart or smarter than the very top few % of US science, math, computer graduates..
Why? The US like the propaganda aspect when they return home, some might invest or be a gateway for US products and services back home after years of exclusive, intensive US educational experiences.
The payments per seat is a nice win for the educational institution too.
What was 1950-90's inward looking US academic exceptionalism is now a world wide production line of random students equal to the best emerging US academic experts. Advanced math, science, crypto, physics, design are now just gifted away to anyone, any nation with the cash, every generation.
Other nations are repatriating that US academic excellence, merging it with their own regional low costs and winning.
Merit based US education is also a long term question given the costs of seats per year per class and pure academic top percentile over the nation and decade.
Is US standardize testing still ensuring only the very best academically get the limited places with the very best educators?
The US can bring in a lot of experts from around the world to keep cost down and have union free staff but at a point its going to need a lot of security cleared trusted locals of a very high standard.
A vast pool of US taskforces, ONDI, OICI, Dept of Energy, NSB, treasury, NRO, NSA.. will all need next gen staff from a shrinking pool of top, trusted cleared graduates.
So will the US private sector that services the above mil and gov sectors. How can the US stock its "strategic partnerships" with staff? Try NZ, UK, Australia, Canada with staff that work on US sites? Try Germany again? Virtual desk from some distant land for the US mil?
Re "Also as an aside, what's wrong with being #2 or #3 in something?"
Look back to emerging jet, nuclear, computer and rocket design and production lines in the 1930-70's. Lots of nations had their own projects but had to drop out/got forced out and all the expert work just drops away a over a generation of workers. Once a local work force from the workers, scientists, technicians, engineers drop behind the costs to catch up or even import what is needed is expensive or not an option.
A lot of complex projects demanding equal access to the same number of trusted graduates.
Thats why South Africa, Brazil, India, China, Russia worked so hard to create and keep their own national jet, rocket, nuclear, computer production lines at any cost.
The UK has its Skynet project from the 1970's - huge imports of US hardware as the UK just did not have the ability to produce or create the needed mil standard sat parts for own military communications networks and terminals. In the end it had to buy in US export grade sat systems with the US having some say in what got offered and how the UK would be allowed to use the final product. Never good to be #2 or #3 in something a nation needs to have total control over.