The government and Michael Gove “misunderstood and misapplied” planning rules when it blocked Marks & Spencer’s plans to demolish one of its flagship London stores, the High Court has heard.