Because it is exceedingly rare that a law only does or is claimed to apply to exactly what it intends to do without other consequences.
There’s always some lawyer who will claim that a law applies even if it it found that doesn’t. In fact, this is entirely normal. Legal cases have two sides and only one will be found right.
The motivations of the lawyers in your examples are entirely different than the motivations of the lawmakers who wrote trademark law, and the judiciary that enforces it.
Let’s be clear: nobody created trademark law for the purpose of a cereal company getting rich off suing petroleum companies. In fact, those who established trademark law purposefully limited trademarks to a particular good or service exactly to prevent that.