That is because the sunroof has a "trough" built into the frame. Which the sunroof drains are connected to. And at the bottom of the sunroof drains are rubber connectors which when they get full of water sometimes they get disconnected. Also the so called "trough" when the drains get clogged the trough overflows with water and leaks on the headliner which drains down the a pillar and then on the drivers and or passenger floors.
There should be a recall on all MK4's and MK5's for the sunroof drains. If there is any water damage VW should cover it.