Not sure what definition of spice you're using, but Wikipedia calls it "a plant substance primarily used for flavoring food", which garlic definitely is.
I would define a spice as a non-nutritive plant substance used for flavoring and not consumed as an independent entity. Garlic is not non-nutritive, and it is consumed by many people as a whole food. Whole roasted heads of garlic are awesome.
Why does it need to be non-nutritive? That would rule out things like ginger, many chili peppers, some plant greens like basil, even sesame seeds. I would consider all of the above spices, as well as garlic.
I would consider all of those to be vegetables, herbs, or other types of consumables, not spices. I would consider dried and ground chili peppers a spice, and fresh whole ones to be a vegetable.
That seems reasonable. But then to bring it back around full circle- would garlic then indeed be a spice, when used as an individual clove finely chopped in a larger dish for flavoring purposes (or garlic powder), by the same logic you're applying to peppers?
Not a big deal though. It sounds like you apply stricter categorical food definitions than I do, and that's fine. It's hard to draw exact lines.
My apologies - fresh ingredients like those would be fine in my case. I was unclear and meant processed spices in powdered form which seem to act as some kind of gut irritant (for me)