There’s no evidence other than Dabney’s claim that Lee ever said that.
. . . and Lewis Dabney continued to preach and write in support of slavery for thirty years after the Civil War. Not just in support of the Confederacy, but in specific support of the institution of slavery. Lee's alleged comment to Stockdale, allegedly recounted to Dabney, was certainly . . . convenient . . . for the pro-slavery, lecturing Dabney.
Both the language and spirit of the alleged 1870 comment are inconsistent with Lee's writings and statements of 1870.
Lee believed that secession was revolution - and he knew secession was not the peaceful exercise of a right that the states or citizens of the United States had preserved. In an 1861 letter to his son, Custis Lee, Robert E. Lee wrote:
Secession is nothing but revolution. The framers of our Constitution never exhausted so much labour, wisdom, and forbearance in its formation, and surrounded it with so many guards and securities, if it was intended to be broken by every member of the Confederacy at will. It is intended for 'perpetual Union,' so expressed in the preamble, and for the establishment of a government, not a compact, which can only be dissolved by revolution, or the consent of all the people in convention assembled. It is idle to talk of secession: anarchy would have been established, and not a government, by Washington, Hamilton, Jefferson, Madison, and all the other patriots of the Revolution.
Because Lee recognized that dissolution of the Union, other than by "consent of all the people in convention assembled", was a revolution, he knew he was taking up arms against his country.