Actually they aren't. The law was written so that slaves were considered citizens. It wasn't for illegals who had children here.
This is true in a sense, but not for the reasons implied. It's because when the 14th Amendment was written, there was
literally no such thing as an illegal immigrant. The first federal law restricting immigration wasn't passed until 1882, 14 years after the 14th Amendment took effect. There were certainly prior laws restricting who could
become a naturalized citizen after immigrating here... but the 14th Amendment is clearly intended to expand qualifications for citizenship.
So if we are taking an originalist viewpoint, the very concept that someone could be an "illegal immigrant" would have been bizarre and foreign to the drafters of the 14th Amendment. At the time that amendment was passed, it would have been crystal clear (and the explicit intention) that immigrating to this country necessarily put you under its "jurisdiction," and that anyone born to an immigrant would be a citizen. In other words: it was the express purpose of the 14th Amendment to grant citizenship to the children of people who, themselves, could not qualify for citizenship. It was not an accident.