Sure an engine replacement is a large repair with a large repair cost (flagged hours) to the technician. But warranty process pays 60-75% of what 'customer pay' is (customer pay is the standard hours for the job as codified in labor manuals such as Mitchells). In other words, an engine replacement is say 20 hours for customer pay. For warranty the cost is 15 hours. The manufacturer has a non-negotiable discount in labor costs under a warranty repair. I was a dealer tech for Ford many years ago and they had this system. It had been in place for a few years before I started.
On top of the forced discount, there is minimal to no time allotted for diagnosis and verification of repair.
I had an engine warranty on a big E 350. V-10 had all main bearings spun. You have to fetch the engine from the front. Dual air conditioning compressors. Whole front comes off. Grill, lights, radiator, etc. Job took me 34 hours. I was allocated 20 flagged hours. A regular Econoline was 15 hours. I got 4 extra hours for the extra air conditioning work to R&R and 1 hour for diagnosis and verification combined. Customer pay hours were in range of 30+ hours.