Legally you are correct.
But how can betray anything if you were never on that side to begin with?
Traitors are not always originally on the side of the country they are attacking to start with. Moles and double agents can be on the side of the enemy from the start and merely deceptive. Of course, in Obama’s case, the media never vetted him, making them complicit.