Your confusion stems from the fact that you are looking at the situation though a developers eyes. The acquisition of Instagram has nothing at all to do with the code. Nothing. It's about Instagram's users, their brand, and their founders / team. Instagram has ~27 million users [1], a good brand and smart founders. Their engineers probably know a thing or two about scale too, which I'm sure facebook would find useful.
[1] http://www.quora.com/Instagram/How-many-users-does-Instagram...
PS. IMO, most startup logic makes a lot more sense when you stop looking through developer-centric goggles. You're not making code you want to turn into a company, you're starting a company that you want to produce code...