I did something similar with an earlier version of my Tarkatans. (Males would attack each other.)
The trick is to use GREETING interactions and the CE_ERRATIC_BEHAVIOR tag, combined with VIOLENT personality modifiers (CE_ERRATIC_BEHAVIOR is the tag that makes violent drunks prone to starting brawls). I gave them a "challenge" GREETING interaction that could only target the specific caste (perhaps "looks the other gorilla in the eyes") and causes the target to behave erratically and gain more aggressive personality traits. This will make them likely to start brawls when they are standing around in the same room. Be warned that they will not necessarily attack the actual challenger, they will just attack anyone around. Also keep in mind that this will result in a lot of injuries and broken bones (which is the reason I removed it). You can make gorilla bones not require splints to make these injuries less permanent.
You can even give the king gorillas a "pacify" GREETING ability that makes the pacified target temporarily unable to be challenged so they are less likely to fight when he is around.
The "dominated" syndrome can be a self-targeting FLEEING interaction.
To ascend to "king", perhaps two linked interactions, the first one enables the ability to use the second after a certain period of time, the second one is a self-targeting GREETING applying the actual "king" syndrome, but neither can be used if the user is "dominated". (This means that the "dominated" effect should last longer than the time between these two interactions.) You can even make the initial interaction triggered by the challenge interaction. A gorilla will become king if they are challenged, but do not flee from any fight within this period of time. Or perhaps make things more interesting and the initial interaction could be triggered by a female gorilla, so the competition will only happen if there are females around?
I would make all effects temporary, maybe lasting a year or so, this would allow gorillas to rise and fall from their positions over time.
Because interactions tend to be very unreliable, there is no simple way to do this perfectly, but it should work in a vaguely-defined way provided the time spans are long enough.
I would also advise against using castes, since transformations tend to be weird (only one transformation at a time, and transformation causes full healing). All of these effects can be done through syndromes that add interactions.