That's the whole point of the experiment - you can't get an interference pattern if it does not.
> and the act of detecting which slit the photon could go through, if it were a particle
The whole point of the double slit experiment is that there is only one photon, and which slit it goes through is irrelevant.
Whether a photon is a wave-function is missing the point entirely - the point is how do you get an interference pattern if the photon/wave-function only goes through one slot?
The point of this experiment is to show that sometimes light behaves like a continuous wave, while other times it behaves like a particle of sorts.
And if you think QM has actually provided answers to any of this, you might want to read up... https://en.wikipedia.org/wiki/Wave%E2%80%93particle_duality https://en.wikipedia.org/wiki/Interpretations_of_quantum_mec...
In short, QM might have produced some nice mathematics models, but it's claims about objective reality are contested. Some people don't agree there is any paradox, and that the double-slit experiment correctly identifies light as a wave, and that claims that the photoeletric effect proves light is a "particle" are based on false inference (particularly that energy quantization implies packetization). Some people still seriously propose that consciousness affects basic particle physics (as if particle know when they are being measured).
Despite all that the cool smarty pants brigade who have read some 1st year QM books (while understanding only a fraction) come away all puffed up that QM actually provides deep insight and wide consensus as to the underlying interpretation of reality. The fact is, it's as paradoxical today as when the great physicists up to the last of them (Feynman) correctly identified it as such. Quite sad really.