Will Apple service an iPhone previously repaired by a third-party?
Apple has always reserved the right to only cover under warranty (and their service plans like AppleCare) authorized repairs that use certified parts. I’ve seen this language in the legal agreements since the 90s and can’t source earlier documents to see when it actually started.

https://www.apple.com/legal/sales-support/terms/repair/


1.11.6 Disclosure of Unauthorized Modifications. During the service ordering process, you must notify Apple of any unauthorized modifications, or any repairs or replacements not performed by Apple or an Apple Authorized Service Provider (“AASP”), that have been made to your product. Apple will not be responsible for any damage to the product that occurs during the repair process that is a result of any unauthorized modifications or repairs or replacements not performed by Apple or an AASP. If damage results, Apple will seek your authorization for any additional costs for completing service even if the product is covered by warranty or an AppleCare service plan. If you decline authorization, Apple may return your product unrepaired in the damaged condition without any responsibility.

In practice, the worst that happens is you get a call mid-repair and an explanation why the repair will cost more or why the repair isn’t being completed. So yes, Apple typically does all it can to cover a repair even when it has the clear right to not perform service in my experience.
With batteries and hardware, as long as there’s not case or connector damage and the part is scrapped, there’s little benefit to Apple not doing the repair. The technician is on the hook for a limited warranty so the only time when Apple or a certified center rejects a repair is when they can’t guarantee the repair for the time Apple specifies or they can’t complete the repair with the parts budgeted for that repair. Also, if Apple subsidizes the cost of the repair parts since they can rework a portion of the failed ones and then certify them for repair use later, it seems fair to not pass that cost savings off to someone that isn’t returning same quality parts back into the “repair pool”. The source of those quotes is likely service bulletins that leaked on how Apple trains their staff to qualify repairs and label parts for return and inspection. Apple engineers analyze all manner of failed parts and if the technicians send back non OEM parts, that wastes time and resources on the quality team and also needs to be tracked for failure rate analysis.
But the official stance is they may not service any gear they can’t verify has correct parts and a properly documented service history if the original parts are missing when the repair starts. Apple doesn’t usually grill customers “Did you have any unauthorized repairs?” but it’s in the terms you sign before you hand off your gear if you read all the words.