The European Commission has told Germany it must scrap a law that protects carmaker Volkswagen AG from hostile takeovers or face court action.