“pretty good job”? You mean by sending wave after wave of Union soldiers to their deaths in a war of attrition worthy of Stalin in WWII (much worse than LBJ or Nixon), and by waging war on women and children to the tune of 850,000 dead, 2 million refugees, and the thorough physical destruction of 2/3 of the geographical U.S. while also ravaging the Constitution. I’d say it was a Pyrrhic victory at best.
First, the Union had to both defend against invasion, and invade, and occupy as long as the insurrection continued, a big job. Like the dog that walked on his hind legs, the wonder is not that it did it ill, but that it did it at all.
Second, there was no war on women and children, except that which the rebels made by occupation of various cities, making the cities an object of battle. While the pretended Army of Northern Virginia fought outside cities, the US Army was content to kill them there. Once the outmatched southern forces retreated to cities like Vicksburg, Atlanta, Richmond, the war followed.