I believe Satoshi was working on this idea for quite a while...looking at the code, I don't think this was something he threw together in a couple months. I think he may have been working on it for several years and took great pains to ensure it was sufficiently evolved such that it wouldn't simply die shortly after its release.
Not several years. I think he wrote somewhere on this forum that the actual coding was quite fast compared to the global mental design of the thing.