What is the reason the iPhone wipes after a couple of failed password entries?
As the other answer by Rash Mendis pointed out, the reason why your iPhone wipes all data after 10 failed passcode attempts is probably because you enabled said option 'Erase Data' as shown in the screen shot.

The motivation behind this is to prevent a thief from accessing your data too easily. I imagine there are still a lot of devices using only a four-digit-code to lock the iPhone, and this is all what prevents anyone from accessing your private messages, contacts, Facebook account, whatever. If your data would not be wiped after some failed attempts, all a thief would need is enough time for (max.) 10.000 attempts (probably less), and your data is compromised. It is quite easy to assume that a criminal would get your data in not too much time.

With the erase option on, you have at least a reasonable chance that albeit your phone was stolen, your data might not be accessed. It is basically the same rationale as with entering a wrong credit card PIN; after three (?) attempts your card gets locked.

And finally, if you are certain that your passcode is secure enough, you can still disable the erase option (which I would not recommend, anyway).