@Dominions Son
The opening sentences of the story, in both the Galland and the Burton versions, set it in "one of the cities of China".[12] On the other hand, there is practically nothing in the rest of the story that is inconsistent with a Middle Eastern setting. For instance, the ruler is referred to as "Sultan" rather than "Emperor", as in some retellings, and the people in the story are Muslims and their conversation is filled with Muslim platitudes. A Jewish merchant buys Aladdin's wares, but there is no mention of Buddhists, Daoists or Confucians.
And that was typical of the era.
It must be realized that this is the equivalent of "Oral History". Where the narrator would make their own changes for various reasons. It might be a case like "broken telephone", and the one they got it from had changed it, or they might have changed it to make it more understandable for their audience.
Hell, read the Bible and it is full of such things. Like how most major things happen in groups of 7 or 40 periods of time.
Now I know that Aladdin and Ali Babba were not original but added in later years to the 1,001 stories. However, they do come from a Syrian named Hanna Diyab, who like the Brothers Grimm chronicled a great many folktales. Even adapting stories from Europe into a more familiar Middle Eastern setting for his readers.
One thing interesting about folktales, even as they transition during retelling the setting almost never changes unless it is to bring it to the local area of the reader-teller. In other words, a French tale may change to be set in England for an English audience. But in England itself, a tale will almost never be changed to show it was set in France.
This is known as "Morphology", and those who study folktales can track that through generations of the story being told. That is why there are recognized as being at least 345 "variants" of the Cinderella story.
This is where for those that study it, the ATU number becomes important. As a great many tales all have a common ancient ancestor that is lost. But their descendants still show the older origins.
Case in point, the "Uncle Remus" stories. Those were actual slave folktales, most of them brought from Africa. But changed, to fit their more modern American home. People can read them now and they seem American, but they actually came to us from Africa.
In fact, to get an idea how deep this can go, consider mythology. Africa, Norse, American Indian, all have powerful Gods that are brothers. And they are basically "Frenemies", where one is good and powerful, the other is a "Trickster". As often in the tales working with each other as working against each other.
I am sure most know of Thor and Loki, even if they have never picked up Bullfinch and only know of them from the movies or comics. But then when you read the exploits of Wolf and Coyote in almost all American Indian mythology, the stories are almost exactly the same. And the same is found in Africa, and almost every mythology in the world.
I believe like a great many others that what is seen there is the roots of a very ancient "source", that is probably tens of thousands of years old. And simply changed as humans migrated around the planet. Whatever the original "trickster god" was, in Africa became a rabbit or spider. In the Americas it became a Coyote. In the European myths, the brother or son of the "head god".
Or in some, just a human. Like Maui, who in Polynesian tradition is not a god at all, but a human that played tricks on gods.
But in short, a great many who study folktales believe the story probably originated in India or China, then traveled to the Middle East by traders. Who then made changes until it was finally recorded. But no matter the origin, the story as earliest recorded was indeed set in China.
Just as Hans Christian Anderson's tale "The Nightingale" (1843) was set in China.