Error 1001 when adding custom APEX domain added via API

We are currently developing a platform on top of Cloudflare Pages. We have over 500 Cloudflare Pages projects and we are using the API to add custom domains to them.

Each of our Pages projects uses different DNS providers, such as Namecheap or others.

The issue:
Recently, we noticed that the site is showing Error 1001 when we try to add a custom apex domain. Even if DNS providers support CNAME Flattening through ALIAS or ANAME records, adding these records does not resolve the issue with the custom apex domains added via the API to the Cloudflare Pages project.

How can I fix this?

Here is the screenshot of the custom domain settings in cloudflare dashboard

Here is the screenshot of the DNS record

I can see that DNS records were propagated successfully and those IPs are pointing to cloudflare.

No idea why cloudflare is not identifying the APEX domain even if the cname flattening is in place. This is not a one time issue, we face this issue for multiple pages project, that uses different DNS providers like namecheap, godaddy etc.

Am I doing something wrong?