He resigned his commission in the U.S. army and fought to defend his home (Virginia) and family from the yankee invaders. To have done otherwise would have been the real treason.
You may find it interesting that Robert E. Lee was post commander at Fort Hamilton in Brooklyn, NY. The Church where he had (an adult) Stonewall Jackson baptized still stands in the neighborhood. I would pass it daily on my walks home.
Lee was a fine General, and an upstanding individual in his personal life. Nevertheless, he sided against the USA, which was represented by the Union.
Personally, I've always loved the fact that the South was for Free Trade while the North (including Abe Lincoln) were Buchanan-style protectionists. Makes it odd that the "Paleocons" who claim to be "sons of the South" embrace the economic philosophy so popular with Lincoln and Seward, yet despised by their ancestors.
He was a traitor to the United States of America. Are you going to do likewise ?