By your reasoning, loyalty is a matter of ancestry, not free will.
Not at all. That is taking it to an extreme. But if you have no familial ties to another country the chances are greatly reduced that you will have loyalty to them. It is still free will, but without those ties, the chances are greatly reduced.