Unless you are talking botany, calling a tomato a fruit is falling for the fallacy of equivocation and too many people do this and have the pretension that they are being smart. The word "fruit" has multiple definitions, a tomato is a fruit by definition 1, but not a fruit by definition 2.
What most people understand by the word fruit is definition 2.
https://en.wikipedia.org/w/index.php?title=Onion&type=revisi...
Apparently a fruit is the ripened ovary of a flowering plant, enclosing the seed or seeds--not a bulb like an onion.