99.9999999% of software written is not published, it’s covered by trade secret law. Copyright only applies to published works. Look into what happens legally when source code is leaked and published.
This has not been true for a very long time.
Software can simultaneously be covered by copyright, trade secret and patents. The patents have to disclose some info, of course.
Even when distributed you can distribute just the binary, and keep the source a trade secret.