Europe’s largest residential property group Vonovia has agreed to buy rival Deutsche Wohnen for €18 billion, in a deal that will reshape Germany’s real-estate sector.