Well, it isn't a coincidence, really, but it isn't the sun that causes the rotation axis to be perpendicular (more or less) to the plane of the planets. It has to do with the way that the mass was distributed and collected into planets from the solar disc at the time of formation some 4.5 billion years ago. There was a rotation of material in that disc, so the planets migrate around the sun in the same direction, and the planets spin on their own axis in the same direction, and exist in essentially the same plane (rather than running around the sun in all sorts of different directions and angles).
And one of the planets (i forget which one) is tilted more or less so that one of its poles faces the sun. Another migrates considerably far outside of the sun-planet plane (maybe it is the same one, I can't remember, but now you have made me want to look this stuff up to remind myself and add MORE clutter to the attic of collected information that is my head). I do not think there is one planet that migrates around the sun in the wrong way, but for some reason I wanted to say that.
Now I really do have to look this stuff up or it will bother me all day. you get a star for giving me something to do that isn't writing that report I have to finish this weekend (I was looking for an excuse).
EDIT: Uranus is bent over sidewards (one pole faces the sun). Three planets spin in the opposite direction (retrograde direction), which is the same as saying that they are upside down. Pluto is the "planet" that migrates outside the ecliptic (the sun-planet plane).