Ever seen that episode of Star Wars: The Clone Wars where a ship full of clone troopers (and Barriss) was taken over by Geonosian brain worms? Yeah, Samus' situation is kinda like that.
Speaking of that episode, I can't be the only one thinking there was some wasted potential in the brain worms. You'd think Palpatine would catch wind of the incident and, much like how he intended to clone the Zillo Beast in order for its scales to be used for more resilient armour for the Grand Army of the Republic (and, later on, the Galactic Empire), he would have studied the brain worms and used Sith alchemy to control them. That way, when he turns the Republic into the Empire, he can use the worms on any rebels he captured and have any budding rebellions crushed from within.
Then again, I wouldn't be surprised if the existence of the brain worms is one of the reasons he committed genocide on the Genosians by the time of Rebels. That and to obviously cover up their involvement in designing the Death Star.