yes, the nunchaku (and not nunchakua ) (ヌンチャク) originated as a grain flail (or in that case - a rice flail)
Threshing flails were used all over the world as farming tools for - well - Threashing grain ..
.. and yes , more or lessat the same period there was some kind rebellion under the Satsuma daimyo that resulted both in a moratorium on edged weapons AND a campaign to confiscate arms.
Those campaigns were not so rare - and actually the the peasants - and sometimes whole areas were forbidden from having weapons and / or military training.
Most of the asian martial arts evolved exactly for that reason - it was the only way for the people to have some kind of military - defense and training without provoking problems .
this is also the reason why many of the martial arts have parts masked like sorts of dancing OR religious praying.
That being said - it seems that no one can pin-point the exact location or period of when the nunchaku was originated . the Japanese claim okinawa, and the chinese of course say it is from china (they also had flails like the rest of the world) - but the majority of historians do not debate about the flail but about the adaption of the flail as a weapon for military training - and in that respect - the answer seems to be Okinawa and yes - the origin was an adaption of the flail.