It does raise the question of the steps that happened to reach that functionality (not suggesting intelligent design here). I'd assume there'd be quanta of evolutionary evolvement but it isn't clear what that would look like (especially to someone like myself who is not an evolutionary biologist).
Scientists collect many examples of different type of flagellum. So we can understand how it change during the evolution process. This article introduces the finding of organism structure.
One thing to know about DNA is chunks of it can around not doing anything for long periods of time till suddenly more DNA comes in from somewhere and suddenly you have working behaviors. Things like Transposons are crazy.