1. The count rebels against his liege, the duke of Provence, and declares war on him
2. The liege of the duke of Provence, the king of Germany, Burgundy and Italy comes to the aid of his vassal (the duke of Provence)
3. The king of Germany asks his ally, you the player for help
4. The count, who is independent offers his vassalage to the king of Germany, Burgundy and Italy
5. The king accepts this offer
6. You declare war on the count
7. The count is a vassal of the king of Germany now
8. The liege of the count, the king of Germany, comes to the aid of his vassal and declares war on you
It is sort of a bug
Always check first who you are declaring war to, never go into a war when an ally has to deal with a revolting vassal or sub-vassal