Actually, government licensing of marriage is fairly recent, and came about due to attempts to prohibit mixed-race marriages. Like most government programs, it never went away, even after its original purpose was shot down.
And no, in the case of divorce, the government does not ensure that you "get back the value you invested" - someone could enter a marriage with nothing and leave with way more than half, or whatever, as the rules of divorce proceedings have many (often contradictory) purposes.
Personally, I find the idea of getting a marriage license distasteful, and my wife and I never bothered to do so, but in the case that's described, I'd say that the benefits outweigh the distaste. Given the pervasive nature of the government, it's inevitable that you will be forced to interact with them on some occasion, and this one seems fairly minor relative to the benefits that result (ie, being able to move here and not get hassled constantly).