Hmm… once I did something like to add a new front matter field to all posts belonging to category X or Y, and find all articles with category Z, remove the category and paste it to the tags field (so that Z was not a category anymore but a tag). I did that with vim/neovim, grep and REGEX. Grep for the search, Regex to find exactly what I needed and neovim to make to properly edit each file. I was curious about these three tools at the time and it was a pleasure to learn, though I am sure you could find the same functionality on another text editor (but afraid you cannot avoid the REGEX part).
Another (kind of) solution that comes in mind now, would be to make use of some fuzzy finder like Fzf.
What I said above doesn’t make sense, of course you can perform searches without learning REGEX, but still… in order to get that level of precision you’ve described you’ll will need to find a way to give detailed search patterns to be found (the most basic one I can think of, would be to insert/remove a comma after a category name, e.g.).
Anyway, this is probably something to be done from your text editor or OS, since jekyll is not that intrusive, and it (luckily AFAIK) doesn’t play smart.