> assuming typical restaurant margins
I think Domino's margins blow typical restaurant margins out of the water. I don't have hard numbers, but worked a variety of delivery jobs from 2010-2014. Domino's was the only place with the attitude that their food was worth pennies to produce.
Most places didn't offer discounts to their employees, not even for food that was mistakenly made and had to be trashed. Domino's was the only one that would just allow employees to make themselves a pizza for lunch or to take home for dinner (but no feta cheese, we had limited quantities of that).
Call and complain about any Domino's order, even over the dumbest thing, and they're supposed to give you a credit for a new order. It was drilled into my head as an employee. If someone complains, give them something free, and they're pretty much guaranteed to order from Domino's again in the future more times than they would if you had never made a mistake.
Also an individual driver could do far more deliveries than an app-based delivery worker can. The routing software they used at the time was really good, and would group 2 nearby orders for one trip by a delivery driver. There was never any waiting unless there were no orders at all. From what I hear with my friends who work UberEats/GrubHub, a lot of time is wasted at the restaurant waiting for the food to finish. McDonalds (at least in my area) is a big offender, marking orders as ready for pickup when they haven't even started making them yet. Having all food coming from a single storefront, and being able to take multiple deliveries at once is a big deal.
As for why places like Pizza Hut and Burger King can't do it as well, I guess it comes down to the tech and management. When Burger King tried offering first-party delivery services it was a massive shit show. I worked there for a bit, as they were the only store paying drivers 100% of the delivery fee. It ended up being a terrible deal because I would average 1-2 deliveries per hour during the lunch and dinner "rush", while a great day at Domino's could have me doing 10 per hour. Pizza Hut wasn't as terrible as when BK attempted it, but I feel like it only worked because they have a limited menu and not because they're actually competent.