While that IS the stated reasoning of Lee, there are some historians (Bonekemper, etc.) that suggest that it really looked like Lee was considering multiple options and that his decision to go with the South might have reflected more calculation than loyalty. That's unproven, but worth considering.
From what I understand, Lee did
genuinely consider Winfield Scott (and by proxy Lincoln's) offer of commanding the Union army, but couldn't bring himself to fight against Virginia. Even then, he tried to sit the war out in Arlington and was gradually pulled into accepting a commission in the Confederate Army.
It's also worth remembering that Lee came from
old Virginia royalty, and married basically the closest you could get to Southern royalty (not to mention being the daughter of Washington's adopted son). On top of that, given that his father was by all accounts a total fuck up, Lee had raised himself to be what he considered a paragon of Southern virtue. Barring some serious POD, Lee was always going to follow Virginia. If he was branded a traitor (ala Lee at the Alamo), he'd take the hit
hard, and probably would just sit the war out. Even if he
did somehow end up in the Union, he would almost certainly refuse to fight in a theater where he'd be going up against other Virginians, so it's the West or the Southwest for him.
That said, I would kind've love a TL where Lee takes Virginia turning against him, after a lifetime of trying to live up to the platonic ideal of a Virginia planter, as the impetus to go full scourge of God on the South. Lee had a
serious temper, one that he always struggled to keep in check, and the idea of him saying "Fuck it!" and going on a rampage is too tantalizing an image to ignore.