This does not address any of the points I raised. You're just reiterating what you already wrote. Here's an abbreviated summary of the history;

1. Jews exist in a region.

2. Muslims take over. Conditions improve for the Jews.

3. Time passes.

4. Muslim civilization declines.

5. Internal strife and conflict. Among others, Jews are blamed.

6. Commenters 1000 years later; "This was caused by incipient hatred of Jews by Muslims."

This does not explain why conditions improved when Muslims originally rose to power in various regions. Again, the persecution of minority population is an expected result of the decline of civilizations. From the Wikipedia article your Twitter source is quoting, https://en.wikipedia.org/wiki/History_of_Moroccan_Jews: "Morocco's instability and divisions also fueled conflicts, for which Jews were frequent scapegoats. The First Franco-Moroccan War in 1844 brought new misery and ill treatment upon the Moroccan Jews, especially upon those of Mogador (known as Essaouira). When the Hispano-Moroccan War broke out on September 22, 1859, the Mellah of Tetuan was sacked, and many Jews fled to Cadiz and Gibraltar for refuge. Upon the 1860 Spanish seizure of Tetouan in the Hispano-Moroccan War, the pogrom-stricken Jewish community, who spoke archaic Spanish, welcomed the invading Spanish troops as liberators, and collaborated with the Spanish authorities as brokers and translators during the 27-month-long occupation of the city." This is a nation in decline, lashing out at every perceived cause of trouble, like plague-stricken Europeans slaying cats and dogs and flagellating themselves.

Here are some other quotes from that article;

"The golden age of the Jewish community in Fez lasted for almost three hundred years, from the 9th to 11th centuries. Its yeshivot (religious schools) attracted brilliant scholars, poets and grammarians. This period was marred by a pogrom in 1033, which is described by the Jewish Virtual Library as an isolated event primarily due to political conflict between the Maghrawa and Ifrenid tribes."

"The position of the Jews under Almoravid domination was apparently free of major abuses, though there are reports of increasing social hostility against them – particularly in Fes. Unlike the problems encountered by the Jews during the rule of the Almohads (the Almoravids' successor dynasty), there are not many factual complaints of excesses, coercion, or malice on the part of the authorities toward the Jewish communities."

"During Marinid rule, Jews were able to return to their religion and practices, once again outwardly professing their Judaism under the protection of the dhimmi status. They were able to re-establish their lives and communities, returning to some sense of normalcy and security. They also established strong vertical relations with the Marinid sultans. When the still-fanatic mobs attacked them in 1275{note; no source for this on the Wikipedia page, no link; unable to find what this is referring to}, the Merinid sultan Abu Yusuf Yaqub ibn Abd Al-Haqq intervened personally to save them. The sovereigns of this dynasty benevolently received the Jewish ambassadors of the Christian kings of Spain and admitted Jews among their closest courtiers."

This is not what I would expect of a civilization that is fundamentally racist towards Jews. I would not expect, for example, a Louisiana governor in the 18th century to appoint a black man to be his advisor, yet we see Jews in the position of vizier in Morocco. This does not square.

Racism is not the most useful lens to view this relationship through. The culture of the Middle East is low-trust compared to post-Enlightenment Western societies. There remain sharp social divisions based on old tribal allegiances in even developed nations there (unsurprising, perhaps; there remain living people who remember that this tribe used to be slavers and that tribe killed our uncle and so on). Lashing out at neighbors who one thinks are being treated too favorably has little to do with race or religion, in my experience, and more to do with envy. It is the narcissism of small differences writ large and exacerbated by actual stakes.