The trouble with that is not that it is illogical but that it is mad. Here is GK Chesterton:
If you argue with a madman, it is extremely probable that you will get the worst of it; for in many ways his mind moves all the quicker for not being delayed by the things that go with good judgment. He is not hampered by a sense of humour or by charity, or by the dumb certainties of experience. He is the more logical for losing certain sane affections. Indeed, the common phrase for insanity is in this respect a misleading one. The madman is not the man who has lost his reason. The madman is the man who has lost everything except his reason.What materialism does is it says good and bad are an illusion. When we feel something is morally good it is just a statement about which neurons fire in our brain in response to this stimulus. Same when we feel something is morally evil. But when you understand good and evil that way then they lose their meaning. There is nothing inherently good or evil about a certain configuration of a neural network. We connect moral feelings of goodness with some sort of absolute goodness. If the pure materialist is right then our moral feelings have a cause that has nothing to do with morality. In fact, the cause must be that feeling that way about things like that somehow created a survival advantage for our evolutionary ancestors.
The madman's explanation of a thing is always complete, and often in a purely rational sense satisfactory. Or, to speak more strictly, the insane explanation, if not conclusive, is at least unanswerable; this may be observed specially in the two or three commonest kinds of madness. If a man says (for instance) that men have a conspiracy against him, you cannot dispute it except by saying that all the men deny that they are conspirators; which is exactly what conspirators would do. His explanation covers the facts as much as yours.
So moral obligations disappear. What we have is moral feelings. They are selfish. If I do good then I feel good. I might risk my life to save yours. But I didn't do it to save you. I did it because evolution has programmed my brain to feel an obligation to do it. I would feel bad if I let you die. I don't want to feel bad so I saved you. But it is not even selfish. All choices are based on brain chemistry. Even the choice to selfishly follow my own feelings is reducible to brain chemistry. It is like the earth going around the sun. It is just following the laws of science and there is no choice happening moral or otherwise.
There is a certain implausibility of evolution creating moral impulses that developed over thousands of years into the complex history of human ethics that we have seen. But that is answered by faith in science. Science will find a more plausible explanation. Like many answers based on faith it is unfalsifiable, a bit like the madman's theory of a conspiracy against him. Still true beleivers find it convincing.
The real problem comes when you look at the conclusions you arrive at or rather are unable to arrive at. You can't say that another person's action is immoral. When you first say that it sounds OK. It is the ultimate in non-judgmental thinking. But when you start to go through some examples almost nobody believes it. Hitler is the classic one. Do we have any basis for judging Hitler's actions to be immoral? But there are more. If a Muslim country chooses to educate boys and not girls is that just fine or is that wrong? What about a racist culture? What about a rape culture? Do you really want to say that if a society is OK with something then it is OK.
Even if society is not OK with it. So what? If a country is ruled by a dictatorship and people struggle for a long time at tremendous cost to try and bring freedom and democracy then what do we say? The dictator is doing what he thinks is good for the country. The rebels are doing what they think is good. But true goodness does not exist. We might cheer one side or the other but that is just our minds reacting to stimulus. We are imposing our cultural thinking on another culture. We need to learn to stop judging.
This has the effect of making morality completely arbitrary. What will happen in that case is the state will step in and declare morals and impose them by force. People don't grasp the problem. They really think a state-imposed morality would be pretty reasonable. We are a few years removed from Nazism and Stalinism. People forget. People assume humanity has gotten better and we are no longer capable of such evil (even as they deny there is such a thing as better or evil).
You can see how this can cost us everything but our reason. Does that make it less likely to be true? If we can't prove conclusively that morality exists outside the brain exists then should we not assume the simplest theory that explains the data? It depends on what you count as data. Ultimately we get data from our senses. We see, we hear, we touch, we taste, and we smell. If those senses did not exist we would not know about the physical world. In fact, we cannot rationally prove the physical world exists without assuming something about the reliability of our senses.
So what about the moral world? Do we have a moral sense that tells us something about moral realities? If you think of it that way then materialism does not explain the data. We sense that going into a school and killing 20 children is wrong. If the gunman's neural network didn't register it as wrong that does not matter. The wrongness is bigger than his brain. Can we sense that just as plainly as we can sense the sun in the sky? If we have to assume our physical senses are reliable is it such a big stretch to assume our moral senses are reliable?
Sometimes atheists import Christian standards. The might say "obviously preventing the loss of human life is most important." Who says? It was not obvious to the Rwandan Hutus who decided to kill all the Tutsis. The point is that atheists will try and smuggle in some moral principle and reason from there. The trouble is that all moral principles have their roots in moral feelings or divine revelation. If you deny one and claim the other does not indicate actual good or evil then your reasoning has no starting point.