Apple knew they didn't need to unlock the phone. At some point a vuln was going to get discovered that would let them in, and that's exactly what happened. This way Apple gets to look like a privacy respecting shining beacon of goodness for users, while simultaneously handing over iCloud access and letting China do whatever the hell it is they do.