While similar at a glance, a patent and NDA are two different things. A patent proves an idea was ours first and keeps someone else from inventing the same thing at the same time. An NDA keeps you from talking about the details of what you learned about a project, but the nda only surrounds whoever wrote it. So if someone else has the same idea as you for a project, since you did not get a patent, they would be free to market it. A patent protects the project; an NDA protects the idea and process.
I don't think an NDA is a substitute for a patent because they have different purposes. A patent provides. legal protection for an invention and gives the owner the right to prevent others from making, using, or selling the patented invention without permission. An NDA is a contract that requires the parties involved to keep information confidential. As mentioned before, an NDA is useful when working with contractors, collaborators, or companies that may need access to confidential information before a product is fully developed or ready for patent protection.
There are situations where a patent may not be necessary. For example, if a company has developed a unique manufacturing process that is difficult for competitors to discover, they could just protect it as a trade secret. Of course this would mean the company would need to take careful steps to maintain the trade secret confidential. In the end, it all really depends on what is being protected, how developed the invention is, and whether the benefits of patent protection outweigh the costs and disclosure requirements.