Our Gemara on Amud Beis tells us the following principle:
גּוֹי וְעֶבֶד הַבָּא עַל בַּת יִשְׂרָאֵל — הַוָּלָד כָּשֵׁר.
If a gentile fathers a child from a Jewish woman, the child is not a mamzer and considered a Jewish person.
The Arvei Nachal (Vayyigash 2) explains this in terms of its metaphysical implications. Let’s begin with a basic assumption that if the halakha dictates such a position, that a child of mixed parentage is still Jewish, then there must be a redeeming purpose to it all. Within every impure energy there are also sparks of pure and kosher energy. Ordinarily, through engaging in good deeds with the physical world, the righteous are able to extract the good energy from the impure energy leading to the birthing of new souls. Interestingly, this is why he says the Jews in Egypt were giving birth six at a time. Egypt was the epicenter of impurity, and the Jews were redeeming impure forces at such a wholesale rate that the birthings of new souls were exponential.
Furthermore, whenever a purity is extracted from the impurity to produce a pure soul, there is an evil twin soul left behind. Unconsciously, the evil twin has an intense irrational hatred for its pure twin. This explains the Egyptian hatred toward the Jews. The Egyptians were reacting with revulsion toward their pure Jewish doppelgänger counterparts.
Yet, just as when refining metals, there is always a residue that cannot fully be recovered, there also are pure forces locked within the impure that cannot be liberated. This is when an impure gentile is drawn to a Jewish woman. There are pure forces within that cannot be extracted except from a more direct process. This is what drew the Egyptian to Shelomis bas Divri. In addition, when it says that Moshe looked here and there to see that there were no other men before he killed the Egyptian who was beating Shelomis’ husband (his rival), there is more depth here. Indeed as the Midrash says, he was looking to see if this man was destined to father any worthy descendants. However, now we can understand it more deeply. Moshe was making sure that the child he had with Shelomis was the last purity within him to be extracted, so that Moshe could terminate him without repercussions.