I've also worked on complex web applications/systems, where operation of the web site is ultimately the cost that needs to be continuously borne to extract profit from software itself. Yes, someone else can optimize and do operation better than you (eg. see Amazon vs Elastic and numerous other cases of open-source companies being overtaken by their SW being run by well funded teams), but there is low risk of illegal use in this case.
Today I am paid to write software that the business believes will provide them profit that will pay for my services. The software I write is tied to a physical product being sold and is effectively the enabler and mostly useless without the physical product itself.
Other engineers at the company I am at are building software that requires a lot of support to operate as it manages critical infrastructure country-sized systems, and ultimately, even if someone could get this software without paying a license, they'd probably have no idea how to operate it effectively.
Most of the internet infrastructure works on open and free software, where at "worst", copyright protections are turned upside down to make them copyleft if software is not available under more permissive licenses like MIT, BSD or even put into public domain.
Companies that used to pay best SW engineering salaries like Google, Meta and Amazon would likely not face any significant business loss if all of their software (source code included) was publicly leaked: SW is a tool for them to provide an ad platform or cloud infrastructure service.
> Google, Meta and Amazon would likely not face any significant business loss if all of their software (source code included) was publicly leaked
You don't know that. Granted, there are other barriers to entry in some markets, but stealing others' control and data planes would go a long way towards building viable competitors without having to expend the same level of investment.
You're cherry-picking the relatively small number of companies that support your argument. Besides all the software they've built, each of these companies has filed for and been issued mountains of patents (though not copyright, it's another IP protection scheme) and will enforce them if necessary to protect their business. I bet yours might have some, too.