Doesn’t it say somewhere in the Bible that humans had gotten so bad, God regretted making them? That sounds like He didn’t know they were going to get that bad, and if He’d known, He wouldn’t have made them.
Concerning: 2 Chron 32:31: “God left him (Hezekiah) to himself, in order to test him and to know all that was in his heart.”
Only if you assume God didn’t know this was going to happen. It’s a big assumption with no accompanying evidence.