Yes, anything that is part of a fruiting body (it is a seed pod) is considered a fruit. It is a legume fruit.
Vanilla pods are the ovary of an Orchid, this makes them botanically fruits. (Orchids are not legumes but the terms pod and bean are used for both legumes and vanilla thus causing confusion.) In cooking vanilla is a spice. The definition of the term "fruit" is somewhat different in cooking and botany.