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 - threshing grain.
And yes, more or less at 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 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 adaptation 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 adaptation of the flail.