If Egyptian gods are just demonic entities in disguise, why was God ok with Joseph becoming second in command of this government that worshiped them?

Like yeah, I know Joseph didn’t convert to their religion, but why was God OK with him being in charge of a demon worshiping civilization? If the events in the Bible took place in North America, do you think God would let Joseph be second in command of the Mayans or Aztec civilization? Despite them sacrificing people to their deities, because I know for sure God probably would not let one of his own followers work for a civilization like that