Which makes a lot more sense when you know these stories are adaptations of earlier myths. The polytheistic religions they came out of had no problem thinking the gods do evil things sometimes because they feel like it. As things transitioned to monotheism, and “God is good and merciful” was taken as a given, you end up having to jump through hoops to explain why this passage explicitly says God did evil. Even if the explanation is on some level convincing, it’s going to be more convoluted than “these stories evolved from earlier polytheistic religions”.
Which makes a lot more sense when you know these stories are adaptations of earlier myths. The polytheistic religions they came out of had no problem thinking the gods do evil things sometimes because they feel like it. As things transitioned to monotheism, and “God is good and merciful” was taken as a given, you end up having to jump through hoops to explain why this passage explicitly says God did evil. Even if the explanation is on some level convincing, it’s going to be more convoluted than “these stories evolved from earlier polytheistic religions”.