I think it will depend on if it seems like it's anti-competitive gatekeeping or has a legitimate use. The DMA specifically prohibits measure that are meant to gatekeep, but iirc it has allowances for things that have real technical justification.

Certifying devices to make sure they're safe for users, like "this cable is certified as compatible, it won't set your iphone on fire", seems fine.

Requiring your app to be "certified by apple to sell ebooks", and then only granting that certificate to Apple Books, not the Kindle app, that seems anti-competitive.

correct. An example of this is building a WhatsApp client, you need certification from Meta and that seems to legitimate.