A Catholic-ish answer:
We shouldn't be concerned with possible influence of X, Y, or Z on divine revelation, whether from the standpoint of scriptural infallibility or otherwise. Specifically in terms of the divine delivery of the Law [and it's state of perfection or immutability], it makes little different whether God said to Moses, "Don't kill, don't steal, don't cheat on your wives, don't eat hoofed animals, etc." versus "Take the laws of your Egyptian captors, scrap the bit about worshiping the Sun, and add these dietary things to distinguish yourselves from other peoples." Even a sparse reading of written scripture makes it apparent that God "meets us where we are" and tends to direct us from our pre-existent state towards Himself, rather than "replacing" our experience or knowledge with something totally new or foreign.
More generally, the infallibility of scripture should not be confused with a license to read Sacred Scripture out of context (or otherwise careless manners). Sacred Scripture is largely "just" the story of salvation, which is a very long story about a race of people, in a global society, through which salvation does not occur (is not perfected) until the climax of the story when Christ is crucified and rises from the dead. Hence, Sacred Scripture is ultimately Christ Himself crucified, and all written scripture is understood appropriately with respect to Christ crucified. (Revelation 5:1-14 and CCC 134-141). Thus, we can reasonably assume - and confirm in our reading - that events and details in scripture other than the basic facts of Christ's identity, particularly His death and resurrection, are not necessarily "perfect" in a globally or eternally applicable sense. Eg, dietary law is perfect, having been God-inspired, but only applies perfectly if you're a pre-30 AD Jew. And illustrating that point, Christ explicitly denounces the global, eternal validity of dietary laws, despite having been inspired and directed by the Father!
Likewise, and more to the point, since divine law and salvation were not immediate, but rather progressive, we can also assume - and verify in our reading - that the events and details of salvation are built on existing "things" within the reasonable bounds of human malleability. That is, God both instructs people and dwells among them only to the extent that they can reasonably be instructed and dwelt among. These bounds are set in part by the persons' pre-existing knowledge, experience, spiritual state, and culture. And this should be evident to some extent in every word of written scripture, so we should be able to look at most any passage from written scripture and identify the influence of external forces, be they cultural, historical, personal, etc.
Because it metaphorically affirms the hypothesis here, we'll use God's calling of Abram as an example:
The LORD said to Abram: Go forth from your land, your
relatives, and from your father’s house to a land that I will show
you. I will make of you a great nation, and I will bless
you; I will make your name great, so that you will be a blessing.
I will bless those who bless you and curse those who
curse you. All the families of the earth will find blessing in you.
Abram went as the LORD directed him, and Lot went with
him. Abram was seventy-five years old when he left Haran.
Abram took his wife Sarai, his brother’s son Lot, all the possessions
that they had accumulated, and the persons they had acquired in Haran,
and they set out for the land of Canaan. When they came to the land of
Canaan, Abram passed through the land as far as the
sacred place at Shechem, by the oak of Moreh. The Canaanites were then
in the land. The LORD appeared to Abram and said: To your
descendants I will give this land. So Abram built an altar there to
the LORD who had appeared to him. From there he moved on
to the hill country east of Bethel, pitching his tent with Bethel to
the west and Ai to the east. He built an altar there to the LORD and
invoked the LORD by name. Then Abram journeyed on by
stages to the Negeb. (Genesis
God takes an existing man (Abram), tells him that he will make a great nation from him, that he will populate an existing land with another nation already dwelling in it. Abram takes his existing relatives and existing things on the journey to the land. And his journey is in stages. But perhaps most notably, we don't see anywhere in the text where God gives Abram anything he's totally unfamiliar with, nor does God instruct Abram to do anything that hasn't been done in some capacity before.
In the beginning, all things were completely new. But, at this point in the story, and at most points in the story, the concepts and commands are permutations of existing concepts. Everything in every moment is new to some capacity; but it's all made from existing material! E.g., abandoning "home" or moving somewhere else was not a new concept. Worshipping God (or a god) wasn't a new concept. Becoming the father of a nation wasn't a new concept. Even the promise of many offspring isn't new -- that promise is ingrained in the sexual act itself! The only thing new here is the combination of these things as specific promises and commands to Abram specifically in the context of Abram's life.
Any and all "new" details here are only small steps away from preexisting "things."
One more really obvious and more relevant example before we finalize the point is the command not to murder. It's clear that everyone in Egypt -- or at least Moses, his fellow Hebrews, and Pharaoh -- was already familiar with, if not a law, the general wrong-ness of murder:
On one occasion, after Moses had grown up, when he had gone out to
his kinsmen and witnessed their forced labor, he saw an Egyptian
striking a Hebrew, one of his own kinsmen. Looking about and seeing
no one, he struck down the Egyptian and hid him in the sand. The
next day he went out again, and now two Hebrews were fighting! So he
asked the culprit, "Why are you striking your companion?" But he
replied, "Who has appointed you ruler and judge over us? Are you
thinking of killing me as you killed the Egyptian?" Then Moses became
afraid and thought, "The affair must certainly be known." When
Pharaoh heard of the affair, he sought to kill Moses. But Moses fled
from Pharaoh and went to the land of Midian. There he sat down by a
well. (Exodus 2:11-15)
And then later, God gives Moses the general commandment not to kill (murder).
You shall not kill. (Exodus 20:13)
But, this isn't new information for Moses. It's pretty obvious that he and all of Egypt already knew that murder is nay good. Running away after committing the crime is a dead giveaway.
But, this shouldn't concern us in the slightest. For, not only is all material ultimately God-made anyway (per my personal observation below), but as David Stratton noted in response to Affable Geek's answer, the Word of God is written on all men's hearts (Romans 2:14-16). Ie, there is virtually no person or culture in which we can claim God is not in some way present. Thus, we can rightly find God and His precepts anywhere we happen to find them.
And perhaps the most obvious way we can know that it is God's plan to grow salvation out of existing "material" over time is the simple fact that God does not drop Jesus into the world unexpectedly or immediately after the fall. He endures several thousand years, in fact, so that He can work with people - with their preconceptions, their culture, their flaws, etc.. He endures several thousand years precisely so that He is not disorderly or abruptly breaking into the orderly world He created in an orderly fashion!
It doesn't matter whether the Law of Moses was in any way derived from other contemporary laws or concepts. (It's also OK if we can't see any strict connections.) God is free to inspire and guide us in whatever way He prefers. Our only error or concern should be a perceived lack of harmony with our perception of God and the reality God created, since God cannot be in disharmony with Himself. Ie, the truthful studies of creation (art, literature, history, archaeology, science, etc.) can never conflict with the true God or God's Truth. If an "obvious" reality seems to conflict with God or scripture, it's not at all inconceivable that we've applied a hasty understanding to the scripture! (Though, we also do well to refrain from applying a hasty understanding to an "obvious" or readily observable reality as well!)
A personal observation; not necessarily Catholic dogma:
The tendency to work with existing materials is God's preferred method, as we see in the creation story. The initial creative act is of matter and energy is ex nihilo. It seems to happen before Day 1 (as "the earth was [already] a shapeless mass") and during Day 1 (God creates light). But then He creates everything else with that matter and energy (earth, ocean, land, plants, animals, humans) through a process of dividing, grouping, and ordering the existing "stuff." And if this is how God starts out, it's reasonable to assume this is His planned trajectory, which I think we can confirm by noting that Jesus Christ Himself endures the full human process of conception and growth (reorganization of existing matter and energy) - rather than "popping" into the human world out of "nowhere."
It's notable that every particular creation is certainly new as well. And many concepts and law that have roots in other things are also new to a large extent. So, I think we should take care not to suggest from this that God doesn't bestow new information - or at least information that's new to us. Rather, it's the tendency of God to tie new information to things we're already familiar with. And it's also not uncommon for God to "renew" things! Ie, take something we already know and reaffirm it's goodness or significance. Murder, for instance, was obviously already illegal in most societies, including the Egyptian society that the Jews fled before God told Moses to "legislate" against murder!