Hansen's spying for Russia goes back to the Cold War when Russia was an enemy. Awful comparison. A better comparison would be someone spying for South Korea or Great Britain.
It's not an awful comparison. You just have a narrow legalistic definition of treason. I have a broad one. The purpose of a treason statute is to prevent it from happening again and thereby protecting American lives.