Word order questions about prepositions "tagging along with" "wh-" pronouns (like "who", "which", or "what"), but not tagging along with other pronouns (like "that").
"Pied piping" is the term for a special connection between prepositions and pronouns that start with "wh-".
"Wh-" pronouns are pronouns that start with "wh" (like "who", "whom", "which", and "what"). Some prepositional phrases contain a preposition, and have a "wh-" preposition as the object of the pronoun. When these prepositional phrases are moved to a different part of the sentence, the preposition can move along with the "wh-" pronoun. The process by which the "wh-" pronoun drags along its preposition is called "pied piping".
Pronouns (like "that") which do not start with "wh-" do not drag along prepositions.
More details are in this answer.
The "Pied Piper of Hamelin" is a folk-tale about a flute-player ("piper") who wore many-colored ("pied") clothing. According to Grimm's Fairy Tales, the town of Hamelin had a rat problem. The town hired the pied piper to lure the rats out of town. The rats followed the sound of the pied piper's music out of town. But the town refused to pay the piper. So the piper came back, and played a different tune. This tune lured the children out of town! Most of the children were never seen again.