It's not stupidity, it's that there was no such thing as illegal immigration when they passed the 14th so they didn't address it. It was drafted extremely broadly and now we're living with the unintended consequence.
With the exception of maybe the Chinese, immigrants were welcome and no one worried about their children becoming citizens. We were building what at the time was an underpopulated country by European standards.
“...immigrants were welcome and no one worried about their children becoming citizens.”
You need to do some checking up on American history. Americans were historically very careful about immigration. That is why there was no immigration between about 1920 and 1965. The time when immigration was at a high-water mark only involved a few million, and they had to have papers.
Many were sent back.