I think it depends on what you define as Moroccan colonies. Ceuta, Melilla, Ifni etc. are a lot harder than the protectorate.
The treaty to end the Castilian Civil War, had Castile agree to restrain from attacking Morocco as that was a Portuguese area of interest. They did ask, and receive, permission from Portugal to take Melilla despite that but it's only really only once the Iberian Union happens that you see it change from Portugal as the main invaders to Spain. So 15th and 16th century PODs are probably needed to end that, though I don't think a stronger Morocco taking back those cities in the 17th or 18th centuries are impossible, they came close on a few occasions.
But, and I'd assume you know more than me, isn't it quite possible for the Rif to be abandoned after Annual in 1921? I though there were serious talks in that direction, prior to the French entry into the war.