Why’s God so angry with the Midianites?

Who are these Midianites and why is God so angry with them? Here’s the surprising thing that we’ve learned from reading so far: Midian is the son of Abraham by a wife he took after Sarah’s death. So, the Midianites are children of Abraham too, although not via the son of promise (Isaac) The children of Isaac (and Jacob/Israel) have had several encounters with the Midianites both pro and con. It was Midianite traders that Joseph’s brothers sold him to. Later, it was a Midianite woman that Moses married (Zipporah, daughter of Jethro, priest of Midian). So, Moses is related by marriage to the Midianites.
The Midianites were influenced by the Moabites (Moab, father of the Moabites, was the incestuous progeny of Lot and his daughter) to contact Balaam to curse the Israelites. The Midianites should have known better. They knew the God of Abraham. Yet, they conspired with the Moabites and with Balaam.
God was angry with Midian and He judged them for their sin. But it was a measured response. Note the limit of the number of solders used and the sparing of the virgin daughters.
It must have been hard for Moses to carry out these orders against his in-laws. After all, he not only married into their tribe, he also lived among them from age 40 to age 80. But he had learned to obey God instead of man.
God takes sin seriously, doesn’t He?