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."