Dear Curious Ravenclaw,
It is true that Professor McGonagall and I were both Hatstalls when we were first sorted into our houses at Hogwarts. A Hatstall is a person for whom the sorting hat has a difficult time determining appropriate placement. This causes the sorting to take rather longer than usual. In both of our cases, the hat considered Ravenclaw and Gryffindor as possibilities. Very minor preferences and traits finally led our particular placements. In that sense, then, either of us could very well have ended up in opposite houses. Outside of that, however, I certainly don't believe that Professor McGonagall and I could switch places. Aside from the obvious differences in gender and height, she and I possess very different skills and opinions that I don't believe would have been reversed had she been in Ravenclaw and I in Gryffindor. I doubt I could ever match her prowess at transfiguration, and humbly suggest that I may be a better hand at charms than she is
As for the sorting hat, it does indeed consider preference as a very important factor in sorting. In the end, the sorting hat seeks to place students in the house that is the best fit for them. It would like students to be happy with their house. A student who wishes to be in a particular house will not be happy or work particularly well in a different house. In the same way, a student who strongly dislikes his own house is unlikely to thrive. In most cases, however, students prefer the house that fits their personalities, so preference most often aligns with what the hat would have chosen anyway.