You can also use a dedicated action combined with a filter.
Filtering for
NOT genre HAS "Rock"
would list all files which don't have "Rock" in the genre field. Then, applying an action Format tag field for field GENRE with [%genre%, ]Rock would append the genre "Rock" to a possible existing genre.
You can use two actions Replace for field GENRE with
, RockandRock
replaced by nothing (equivalent to removing) to remove the genre "Rock" from a possibly comma-delimited list of genres.