Why do people do postdoc(s) when they can already do research as a professor?
Because the requirements for the majority of professorships are such that very few people can be considered serious applicants right out of their PhD. 

Also, the number of PhD holders looking for a professorship far exceeds the number of available positions which creates a "backlog".

The two are obviously correlated since the higher the demand to offer ratio, the pickier the institutions can be. 

So even in the case where people developed the necessary skills to conduct professor-level research and teaching during their PhD (which should not be underestimated, that level usually requires more experience than what a typical PhD can give), they usually need to spend some years conducting independent or less closely-mentored research along with students mentoring and teaching as a postdoc until they can secure a position. 

Note that the majority of postdoc researchers never get a faculty position.