The main point is that the gene’s effect must cause copies of that gene to become more frequent in the next generation. There’s no Evolution Fairy that reaches in from outside. There’s nothing which decides that some genes are “helpful” and should, therefore, increase in frequency. It’s just cause and effect, starting from the genes themselves.