You are right: quality control will help detect problems but will not prevent them from happening.
I may help to think about a bigger context. Let's assume organizations create things in order to solve problems. There are other reasons to create things, e.g. to create wealth or to create jobs, but for the sake of argument, assume they're primarily interested in solving problems.
There are many activities that go into solving a problem. You need to identify the problem of course, and you need to envision how that problem might be solved. Then you need to go through a process to translate that vision into a thing: requirements-gathering, design, coding, etc.
All of those activities are flawed. Sometimes the problem isn't a real problem. Sometimes the vision for how to solve it is the wrong vision. Sometimes the requirements are wrong, or the design does not meet the requirements, or the code does not match the design, and so on. These activities not flawed because someone isn't doing a proper job; they are flawed because people make mistakes.
On top of that, circumstances change. Today's problem may not be a problem six months from now. Or a solution that makes sense today may be obsolete or wrong next week.
How do you deal with people who make mistakes? You might try using different people, people who never make mistakes. Those people are really hard to find and keep. Alternatively, you can try to design a process that requires people to check each other's work. Individuals will make mistakes, but others will catch them, or at least some of them. This isn't just about testing code; it's also about validating that the problem is real, checking whether the envisioned solution is practical and useful, and so on.
Sadly, even a process designed to detect problems is imperfect, so we build a meta-process on top of that. The meta-process looks like this:
- Try a process
- Pay attention to the outcome, and be honest about what you see.
- Use what you learned from the outcome to adjust the process.
- Go to step 1.
Ultimately, quality is not about doing things "the right way". It is about setting up a feedback loop that encourages gradual improvement.