"All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the State wherein they reside."
That didn't apply to foreigners who were visiting our country, because they were not "subject to the jurisdiction of the United States".
That didn't apply to illegal immigrants, because there was no such thing.
It DID apply to the children of former Slaves.