You are definitely correct that no markets in the real world are truly perfectly competitive. However, studying this market structure is still useful because it serves as a sort of a model or a template for understanding market structures that really do exist (it's also true that there are some markets that come very close to perfect competition).
The way I would think of this is by thinking about how things like physics and biology textbooks work. Perfect competition is sort of like how in physics you always assume that friction doesn't exist. Or like in biology where you have these Punnett squares even though most physical characteristics are determined by more than one set of genes.
So it's really just a model that we can use to look at how things "should" be. With that model in mind, we can compare real-world market structures to it and see how they fall short of "perfection."
Theory of perfect competition is a model used as a parameter especially in the study of characteristics of economic systems and also market structures. Take note, in economics there is need to look at equity and efficiency.
The model of perfect competition acts as a guideline where in an economy competition increases efficiency in allocation of scarce resources. Hence on the other hand afects equity because it brings in the pursuit of self interest where basically one cannot get better off without making someone worse off (survival of the fittest).
Therfore in reality it does not exist but an important area of study because economic agents have to strike a balance between equity and efficiency as prime goals.