Yes, but legalistic nitpicking is the reason these deserters have no fear of the death penalty. Any lawyer worth his salt would argue that we weren't "at war".
Moreover, Congress has the power "To declare War, grant Letters of Marque and Reprisal, and make Rules concerning Captures on Land and Water;"... It says nothing about there being a foreign government being involved. The situation vis a vis Iraq and Afghanistan is little different from the war on the Barbary pirates.
And it'd be a pretty strong argument, because we've been "at war" -- by some definition or other -- for nearly all of my lifetime. I was born in 1970, but the assessment would be the same if I'd been born in 1950.
I don't know the UCMJ well, but I do know (or at least believe, I could be wrong) that the highest form of desertion -- the one that customarily carries the death sentence -- is desertion in the face of the enemy. It's an important distinction.
If you're counting on someone to ship out with you, that's different from counting on someone to cover your backside in a firefight. Failure to do either is reprehensible, but the one that is more likely to get people killed is deserving of more severe punishment. If you're going to bail, better to bail stateside.