There is also a project management overhead cost to outsourcing that must not be ignored and is prohibitive for smaller companies.
If we want to get anecdotal, across many different companies the only place I've seen outsourcing work is in a huge enterprise and only with several expensive and highly trained local devs cleaning up the crap. Otherwise it's just not worth it. AI will take our jobs long before outsourcing does.
I used to be very critic of the quality, specially since I happen to do reviews of delivered code, but then I also have seen the quality of some internal developers at those customers.
All because selling software isn't their core business, so as long as whatever is running on their servers, desktops, tablets, phones, helps to sell their core products (not software), no one cares one single second about code quality and how it is written.
Just like 99% of people don't care how the goods at their local stores are produced.
It already did, it is called globalization and outsourcing.
Business love the wonders of Internet and remote working, paying a dime per hour that they would pay back home, without any of those worker rights guys nagging them.
Specially in any business domain that doesn't focus on selling software.
Consulting, architecture (domain, technical, business), integration and customer management is were software development is going to.
Pure code writing has become like factory work on a distant country, connected by an IP address.