Copilot just has the wrong experience. There is nothing wrong with suggesting an algorithm with a code snippet as an example. That is its core use, and it does the job. It just needs the snippets to be clearly marked as such, with a way to track that you reviewed the code and adjusted it to your use case.
When people make security corrections to those snippets, ideally it would learn the corrections. Perhaps even have a feature to flag a snippet as insecure, to help that process.
Copilot is imperfect, yes. But there is a large grey area between perfect and "utterly wrong"