Yes, because there's a reasonable chance they would not have been invented (or they would have taken much longer to appear) without the economic upside of a patent. Also, a patent trades forced disclosure for a limited monopoly. The disclosure in both of these cases has been very good.
Which are all built on top of the public disclosure of these algorithms, which was required by... the patents!
Prior to RSA being patented, a lot of encryption was proprietary (and probably mostly broken), and nobody could build on top of it. Post-patent, the RSA inventors could publish details and publicize their invention, which led to the alternatives.