I consider teasing to be at bottom aggressive. It is on a continuum with attacking, but at the relatively benign end of the scale. It is sometimes done lovingly or in a friendly way, just like rough-and-tumble play, but it can also be mean-spirited and hurtful. I think those elements are in it even when it is harmlessly meant, just as there is always some pain in humor.
In contrast, flirting has an entirely different purpose. It is meant to attract, and so it is definitely part of mating behavior, even when done in fun and without serious intent.
So flirting can be done to tease, and teasing can be done to flirt, but they belong to two different classes of behavior that overlap in only a fairly small area.