ANSWER: You did not mention which Bible teacher taught this concerning children, or which version of Scripture he was using. Nevertheless, the scriptures you gave indicates biblical illiteracy, and possibly his desire to terrify unwed parents. There are only three instances where the word "bastard," used in Scripture to denote children born out of wedlock, is used.
2 No one born out of wedlock (children whose parents are not married) . . . may be included among the Lord's people (Deuteronomy 23:2)
A mixed race (children born out of wedlock) shall settle in Ashdod . . . (Zechariah 9:6)
8 If you are not punished (or corrected, like a parents toward their offspring) . . . it means you are not real children, but bastards (Hebrews 12:8)
In the Old Testament, children were considered a bastard if their mother was a non-Israelite (heathen) regardless of whether their father was an Israelite or not. Easton's Bible Dictionary defines the Biblical term "bastard" as being synonymous with the word "polluted." In Deuteronomy 23 the term is used to simply mean offspring that are illegitimate. In the book of Zechariah it is used as another reference for a foreigner. Finally, Paul's use of the word in Hebrews 8 was meant to convey the idea of a group of people who don't share in the same privileges as those who are converted.
In your question sent to BibleStudy.org you also referenced the book of Judges in regard to a leader born out of wedlock. What happened in Judges 11 was not God's doing. Gilead fathered Jephthah by a harlot, as well as sons by his wife. When they "legitimate" children grew up they chased Jephthah out of town because he was "the son of a strange woman" (verse 2). If you read the rest of the story you'll find their fortunes changed, and they called Jephthah back home to be their leader.
Our Creator is, without a doubt, no respecter of persons. The apostle Peter, a Jew, was speaking to a group of gentiles when he said that God does not respect one person over another but rather accepts anyone who is willing to listen to Him and do his will (Acts 10:34 - 35).
Gentiles, of course, have no choice as to who their parents are and neither does an illegitimate (born without the benefit of their parents being married) child. The apostle Peter, however, reminds us that if ANYONE, regardless of how they came into the world, fears God and does what is right, that they will be accepted. The nature of a person's birth has nothing whatsoever to do with whether or not they are ultimately saved. Children born out of wedlock does not matter, what really makes a difference is whether a person has a close and intimate relationship with our Father in heaven.