grahame-
I think that the seeming harshness of it all was not to punish an individual, especially for something that he or she had no control over.
And it has absolutely no reflection on today's Christian.
It was to keep the Israelites ceremonially clean as a nation. To keep them separate from any other nation's possible worldly influences.
Personally, I don't think the reference is completely about a child whose parents weren't married at the time of conception. I think the word, "bastard" meant a child born into a forbidden relationships that involved pagan religions or pagan practices. Especially since the proclamation was for several generations.
As for the Moabites, don't forget that Ruth was a Moabite woman and her second mother-in-law, Rahab, the harlot, was from Jericho. Both of these "pagan" women were in the lineage of Jesus Christ. Their ancestors were pagans, but they surrendered to God. So, God is not about punishing individual people here, but about keeping his chosen nation pure in spirit.
Remember Solomon, bringing all of those pagan practices into his household by marrying pagan women? The entire nation of Israel was never the same after his reign.