If you coded it that way, sure. But it doesn't necessarily follow that Apple coded the software in a way that would make it easily accessible. For example - and it wouldn't surprise me if this were the case - every user's data in the cloud may be encrypted using a hash key that incorporates the device's passcode in some fashion. So if you don't have that passcode, you can't decrypt the user's data. And the passcode may not be stored anywhere other than on the device itself.
For example, suppose my phone number is 416-555-1234, and my passcode to unlock my phone is 4321. They might have combined those and used "12344321" as a key to encrypt all of my data in the cloud. So without my passcode, you can't decrypt anything. (Note: I do not, and never have, worked for Apple. I have no idea if this is anywhere close to how they encrypt data. I'm just putting out a simple scenario to illustrate the problem here.)
Apple has said that they would have to completely rewrite the OS, and that said rewrites would open up a backdoor into any user's account. If the scenario I've described above is anywhere close to how the OS actually works, then I can see how this would be true. And that's the problem here, and the problem that the people supporting the FBI aren't seeing - changing the OS would essentially allow anybody's data to be decrypted.
Now, I suppose it might be possible to install an OS rewrite on one device only, but again, doing that opens up a whole can of worms. What's to stop the FBI, or local law enforcement somewhere, from going to Apple and saying, "You did it that time - why not this time too? And the time after this time? In fact, why don't you just push that OS change out to all users so that we can decrypt everyone's data?"