Hello bloiudice,
A drainage pipe drains water (rain or [Hangwasser]) that accumulates around a building.
Whether water accumulates in the basement or foundation area of the house, or whether [Hangwasser] flows towards the house, depends on the property: location (slope?) and the condition of the soil (permeable, impermeable...).
So if there is a risk that rain or [Hangwasser] could damage the house, a drainage pipe is necessary to divert water away from the house – regardless of whether the house stands alone.