This is not the only point of the patent system: you seem to think that any good patents could have been kept as trade secrets.
But that's not the case. Sometimes there would be no way to use a patent as a trade secret, because, for example, it's simply given to the consumer and they can see how it works, easily.
So another important point is to allow people to research and innovate and make it to market under a state-granted monopoly, in exchange for and to encourage doing so.
As an example, suppose there existed a configuration of plastic that easily enabled xyz - but nobody has 'invented' or researched this configuration. If there really is no prior art, then someone could take the time to invent and patent it, and then sell it at a price that both recoups the cost of their invention, and also acts as an incentive for them to have done so in the first place.
This is not theoretical. The cable tie is a great invention. Here's what Wikipedia has to say about it:
>The idea of the cable tie came to Logan while touring a Boeing aircraft manufacturing facility in 1956. Aircraft wiring was a cumbersome and detailed undertaking, involving thousands of feet of wire organized on sheets of 50-foot long plywood and held in place with knotted, waxcoated, braided nylon cord. Each knot had to be pulled tight by wrapping the cord around one's finger which sometimes cut the operator's fingers until they developed thick calluses or "hamburger hands." Logan was convinced there had to be an easier, more forgiving, way to accomplish this critical task.
>For the next couple of years, Logan experimented with various tools and materials. On June 24, 1958, a patent for the Ty-Rap cable tie was submitted.
In other words (if I'm reading it right) from 1958 until 1978 he had a monopoly on making those cheap plastic things. Then it was over.
Today, (and for the past 45 years) everyone could make that piece of plastic easily and cheaply.
Bu the KEY thing is "For the next couple of years, Logan experimented with various tools and materials. " -- THAT'S what the patent system enables.
He would have had zero incentive to do so if he had not had a patent on the invention, for the next few years. People might have "hamburger hands", to this day. Trade secret has nothing to do with it.