Exactly. From everything I have read, General Lee was a very honorable man. He just put his loyalty with his state rather than with his country.
As did a majority of Americans -when we were new.And
understood the US Constitution.
Keep in mind that the term in 1861 was united States.
Virginia was a sovereign State with an agreement with other sovereign states.
It would be much like if the United States (as it is now a sovereign country after the WBTS) pulled out of the UN and the UN went to war with us to prevent that secession.
Would you call G. W. Bush (or yourself) a traitor?