By now, it's canon that the Sorting Hat takes into account the desires of the student -- to an extent -- along with other factors. That's why there are some really glaring mis-matches in the Potterverse.
Hermione: Totally a Ravenclaw.
Snape: Could easily have been Gryffindor.
Clearly, family history also plays into the equation. There's no way Hufflepuff-like Ron Weasley nor Huffle-claw (or Raven-puff) Neville Longbottom should be in Gryffindor, except for family legacy.
Which brings us to the wonderful Scorpius Malfoy. Is there any character in the Potterverse who so nicely embodies qualities of all four houses? He is the clever scholar of Ravenclaw. He is the quiet, hard-working Hufflepuff. He is as brave as any Gryffindor. And he values his family connection to Slytherin.
I know that "Harry Potter and the Cursed Child" is supposed to be Albus Severus' and Harry's story, with Scorpius and Draco merely their "doubles," but I must say, Scorpius is the best character. Without him, Albus would be insufferable, and I would not have enjoyed reading the play nearly so much.
-cg