One of my favourite things to do is take a character and work backwards.
What would have to happen to a person for them to become this?
For instance, Gavla is easy. She's a smart-mouthed, vicious little peacock who felt more at home lording over the other Matoran as the Makuta's lackey than she ever did among her own.
The most likely story there is that she was never really accepted among the Av-Matoran. They might have tried to, but something about her personality or the way she did things just rubbed them the wrong way, and even if they were trying not to show it, she could tell. It wound its way through every interaction until she grew to deeply resent them all. But the same thing that kept her siblings at arms length was accepted and encouraged among the Makuta, add in that she was allowed to take her out frustrations properly now, and of course she would end up like that.
Krika's a self-fulfilling, self-loathing, self-defeating prophesy, so he's not hard either. He never thought he could be good, so he never really tried, and envies people who are or do to the point of violence.
That's the result of an environment that constantly told him there was something inherently wrong with him- probably the other Makuta too- and an internally grown jealousy problem that never got addressed because that would require admitting that he could improve, and his only comfort in being the way he is, is that it's not his fault. At some point, he probably lashed out and hurt someone very badly, no one around him was surprised, and this worldview was cemented as a way to defend himself from both of these things.
A challenge, is Gorast.
She is a manic ball of hatred, anger, and sadistic retribution, but at the same time, she is also a steady bedrock of loyalty, duty, and devotion. The first are pure animal brain, raw emotion running rampant, and as such could have any number of sources, but the latter, those aren't just feelings, those are patterns of behaviour. Patterns that, if you think about it, directly contradict what she currently stands for.
The Makuta had a duty before Teridax' rule, they had a ruler before him. You can cultivate loyalty, you can encourage devotion, you can instill duty, you can inflame all of them until they become destructive and irrational, but you can't do those things in someone who doesn't already value them. So there's our first clue. Before Teridax, Gorast would have been directing these things somewhere else, to Miserix, the Brotherhood, Mata-Nui, or some combination of the three.
Antroz says at one point that Gorast used to be beautiful. At face value, she's stuck as a giant bug now, but Antroz is a member of a species that has full control over their own anatomy. Physical beauty would be cheap to them, put on or taken off at their whim, certainly not something to bring up as a defining feature of someone. So that's another clue. There was something about who she was that was strong enough for even the other Makuta to take note of and admire her for it. Something that's gone now, and probably has been for some time.
When Gali first confronts Gorast, trapping and threatening her, Gorast tells her that whether or not she dies is in her own hands, no one else's. For a lot of characters this would be a boast, given from a place of strength. Gorast tells Gali this from a place of bitter defiance, Gali fully believing Gorast is about to die, and Gorast pushing her to prove that she is willing to kill her before she'll fight properly; and not once does she deride Gali for potentially breaking from the Toa Code. Not only does that imply no small level of suicidal impulse in her, but it's our third clue, and our first one that paints a direct wound. She's been in this position before, and whoever did that to her chose whether she lived or died regardless of what Gorast may have wanted. Given she's alive in Karda-Nui, they chose that she live. And she hates them for it.
So we have our patterns, she has always valued her Duty, she has always searched for someone or something to place her Devotion on, she has always been drawn towards systems that ask for her Loyalty. We have our wound, someone took her agency in these things away. We have what changed, she used to be beautiful.
Gorast used to be Good. She used to be profoundly, steadfastly Good, so much so that even the other Makuta admired her for it. Gorast was a Hero.
So how do you take someone so good that even after millennia, even after casting aside the very idea of good or evil, the most ruthless of her fellows still call it "beautiful," and turn her into a pyre of vicious hate so strong that she not only abandons her Duty, but burns it down on the way out?
You betray her. And not just that, you betray her in a way that punishes her for every single thing that made her good, you do it in a way so vicious and cruel that she could never have even imagined it before it happened. You take everything that she ever believed in, and you destroy it in front of her, you take away even the option to fight it happening.
Someone turned the Toa's Crystalline Protodermis Cage on her. They did it to destroy something she fought desperately to defend. They forced her to live in the shattered world they left in their wake. Someone she trusted did this to her, someone she believed in with all her heart and soul, and they did it all in the name of Mata-Nui.
Then they abandoned her, and no one cared; no one but Teridax. Who, for the record, also did not care, he just saw something he could use.