2 weeks to program this on the server is more than enough time - especially since Apple does not really have a magical server architecture they use that no one else does, even their client OS (OS-X) is based on a Unix kernel - one suspects that they are running Unix based servers mostly - and these systems are mostly open-source with tons of existing code.
I would not be surprised however if they had the code around for a long time, Apple geeks are geeks like everyone else has - and many of them are world class geeks - I do not believe they are idiots.
They probably did not have their security concerns given a proper priority from management before this happens (You will be astounded how often this happens in large scale software products) - probably because of the corporate culture I alluded to before, Google has been dealing with massive scale online services a lot longer than Apple did - where most of Apple's management comes from a style/device/manufacturing background.
Apple is still firstly a device company, and as such - they are going to have more issues with services than companies that came from the other side (See the initial absurd release of Apple Maps). Likewise, you clearly saw that Apple's iOS (the client side) was much more polished from the start compared to Google's earlier Android releases (Android versions 1, 2 and mostly 3 had poor UI and performance, only in version 4 they started to really shine).
I am going back to my original post on this issue, until proven with time, Google had a lot more experience with security on massive scale services that Apple and it has shown so far - it might change in the future, it might become close enough (as Android UI shows, if you continue to work at it, it becomes good and can even overtake the original benchmark in some places).