While I won't go as far as to say that Dominos & co. are trying to run delivery entirely at cost, it is not clear to me that delivery from a shop directly vs delivery with a middle layer (having to pay lots of engineers fancy salaries mind you..) is an equivalent operation.
Remember, delivery apps take the costs and then their cut. That cut theoretically has some pressure from markets or whatever, but ... well.....
Of course delivery has a cost, was even typical for pizza delivery before the apps. If you're that price conscience, takeout always exists.