The issue in one of the cases (San Bernardino) had nothing to do with iCloud data, and everything to do with the data on the device itself. The FBI request was a backdoor into the device. Apple (rightly) refused to add a backdoor to access the phone.
You are referencing data that goes to Apple’s iCloud servers, which Apple was happy to provide because they held the encryption keys. Since then, they have enabled an E2E encryption feature for iCloud data.
I am happy to discuss Apple’s shortcomings, but let’s be clear on which ones we’re discussing