You are right. That WAS a stupid move. The Confederate Commander should have HUNG the whole bunch of them.....
In many cases they did. Look at Pickett's actions in North Carolina.
Which brings up an interesting question. When the rebellion broke out a lot of Southern officers and enlisted left to join the rebel side. Enlisted men at the time signed up for a term of service, same as they do now. Recent West Point grads were obligated to serve for a set period of time, same as now. Wouldn't it stand to reason that the Union could have charged any former enlisted men and any officers who were still under obligation with desertion? And executed them?