Onions may look kind of like fruit, but they are not. To be a fruit in the common sense of the word, something has to be a fruit botanically. Onions are not botanical fruits; they are bulbs. They contain no seeds, and they grow underground. They’re technically stems.
In addition, they just don’t seem like fruit. They are very not sweet. Aside from some interesting people, most would not eat them like an apple. You eat them as part of your main meal, not dessert. You often cook them before eating them. They’re pretty clearly vegetables, even ignoring botany.