Just for vocabulary:
The rectangle badge div is the parent, the other divs are its children. The children divs are all siblings to each other.
So, properties are inherited from the parents to the children, as long s those properties aren't set directly on the children. You can even set properties that aren't relevant to an element, just for those properties to be inherited by the children. Example, you can set a text color on the rectangle badge parent even if it's not a textual element. This property will affect the children.
So your goal can be reached if you find a way for the "online" class to draw a green dot in a child element, without drawing it in the parent div itself. If the green dot is a round corner dic, the green would be the bg color, but if you set the bg color on the rectangle badge parent... well you know what happens. Same thing if you use a bg image, it will also appear on the parent.
So.. the dot could be text. You can use a unicode disc character : ⬤ Yes that's a character, you can alter its size and color in the typography panel (copy and paste the character).
So, let's try it.
Here's your structure:
The title name text and the secondary text have a color defined so they won't inherit from anything. On the parent div (rectangle badge) the text color is set as light gray so that the dot appears gray (offline).
Now if we add an online class to the parent and set the text color to green, the dot should inherit and color itself green:
So, here it worked because we found a way to make it work. Sometimes the structure doesn't allow it and you have to rework it, or move your subclass to a lower element. But your workflow is good: always try to alter upper elements.