I doubt that he understood his acts to be in violation of the Constitution. While he understood his cause was lost, it’s likely he believed he was acting in support of the Constitution, and it’s certain he was acting as he saw his duty. That’s not hard to support in any age.
Honor and duty in Lee’s age were paramount. So I agree that he believed he was doing his duty. He knew, by resiging his commission and taking up arms against the US, however violated his oath.
I believe he did, based on a letter he wrote to his son in January 1861. However he made the decision to go with his state and he never wavered. You have to respect him for that.