Similar cases are recorded in verses 17 and 18. On the one hand it was God who hardened Pharoah's heart, yet this hardening was used by God to deal with the Egyptians, and thereby God Himself was glorified. God used Satan's instigation to carry out His salvation work of His children.
Oftentimes, we may wonder at certain negative situations and rationally reason why it were so. But the Lord in His sovereignty allow them all. In most cases, these negativity are -- to deal with Satan the instigator, to transform us the believers to believe into Him more and positively fear Him and for Him to gain the glory. In most cases, it is an acid litmus test for the people involved whether they are of the Lord or not; and if so, the confirmation of the Lord's hand upon them.
Verse 31 says, "And when Israel saw the great power which Jehovah exercised against the Egyptians, the people feared Jehovah; and they believed in Jehovah and in His servant Moses." If what happened had not had happened, it is very doubtful if the rebellious Israelite would ever recognized Moses as the God appointed deputy authority, and much less, truly believed in Jehovah. So much the more our cases are today.
May the Lord preserve us to be preserved and acknowledge His arrangement even among His children for Him carry out His heart's desire.