Barplots grouped by feature, how does the math work?

Certainly could be, but you'd probably notice any obvious issues by now.

Now that I think about it, sum, mean, and median would all most likely be impacted by uneven sampling. This is the most likely cause of the issue you are seeing.

don't go off the rarefaction curve — look at the total reads per sample.

But even sampling (with the qiime feature-table rarefy action) would be one way to correct this for the purposes of making a barplot. This issue is pretty similar to this topic:

If you want to positively confirm, I'd say export the data and sum those features by hand (first collapse by taxonomy to replicate what barplot is doing)

I hope that helps!