Why did God create mankind at all if in Genesis God said he was sorry he created them?

So God created mankind, gave them everything, gave them free will, and hoped He will create an amazing community of friends He could share life with. But when He saw how people instead chose to pervert their ways and do all sorts of evil, He was sorry He created them. Imagine if you made a robot, and that robot started hating you and plotting against you, wouldn’t you be disappointed?