Possible source: the story of King David's lineage. According to midrash (exegetical works on the Bible), his
father Jesse separated from his mother due to concern about his own Jewish lineage with the intent not to procreate with her any longer. He planned to have more children with a non-Jewish maidservant who instead conspired with his
wife to allow her to be with him one more
time. She conceived and when it became apparent that she was
pregnant the family wanted to ostracize her for her suspected infidelity. Her youngest
son David (who is described in the Bible as being of ruddy complexion and having red hair) was shunned by the rest of Jesse's children - they wouldn't allow him to eat at the family
table, and purposely assigned him to the role of shepherd in the hopes that he'd be devoured by wild animals. It wasn't until the prophet Samuel anointed him as the successor to Saul as King of
Israel that doubts of his lineage were laid to rest.
Stepchild can be seen as a euphemism for bastard.