Why is pitch detection necessary in pitch correction?
I don't know what algorithm you are talking about exactly, as you didn't state that in your question, but my idea of pitch correction consists of detecting the actual pitch and shifting it to the right one.

You ask why pitch detection is necessary. Well, to be able to write a program that automatically corrects the pitch of a recording (i.e. in opposition to a scenario where you are manually checking what frequency is the right one for each instant of time) you should first have an array containing all possible frequencies corresponding to musical notes. That is, a list containing all the values that would be correct if detected, so that they wouldn't have to be changed. If the singer has accurately hit a $\mathrm{C_3}$, then why would you auto-tune it?

Then, you should perform pitch detection using STFT. For each instant of time, there will be a dominant frequency. One (primitive) way to do this would be to find the frequency that shows the maximum amplitude. When you find that maximum (pitch detection), you should compare the frequency where it's located to the array of musical notes you created before. Then, assuming the singer is not that bad and the tone he's hitting is approximate to the desired one, one should take the detected frequency to the closest musical note (pitch shifting). For example, if the maximum is detected at $\mathrm{124 \ Hz}$, one would go for a $\mathrm{B_2}$ ($\mathrm{123.47 \ Hz}$) instead of a $\mathrm{C_3}$ ($\mathrm{130.81 \ Hz}$). I believe there are some things about logarithmic perception that should be taken into account here, but that's not relevant in this question. Take into account that there are pitch detection algorithms, I just used this easy method as an example to make it illustrative.

That's why detection has to be made. You have no way to automatically "round" the pitch to the right one if you don't know what actual pitch the singer is in.