Restaurant wants to minimize dwell time, which is a time that the restaurant does not spend cooking food for a-la minute order. The closer the restaurant is to the customer, the smaller is the dwell time if the customer is always available. That's the reason why the restaurant wants to be where the customers are.
Delivery-only restaurants dwell time is always larger than the walk in restaurant unless the delivery drivers are immediately and always available when the food is cooked and the time to deliver the food to the customer is the same as time time to turn it over across the counter ( for the same type of food ) which means the restaurant will always make less money in the identical situations.
The only thing that the restaurant gets from the delivery only portion is marketing when its menu is available to people who do not know about it. And it competes with every single other restaurant available in the delivery order. All that for the 20-30% discount off every order. That's the math. It is groupon, all over again. And the arguments of those in awe of the business model are exactly the same. It does not work because the best slammed take out places have 20-30% operating margins.
Finally, there's a startup called Crave which is going to kill this entire DoorDash/Delivery/Deliveroo type model - it gives restaurants ability to dynamically price their checks via discounts ( think surge pricing backwards ) for a low, flat per sale price. Think of it as Yelp Cash, but more dynamic and less connected to Yelp.
This actually solves the problem of dwell time. By offering a dynamic discount based on how busy the place is the restaurant increases a flow of orders into the business.