As for Iraq, seems like there really were attacks on power distribution (not generation) that don't seem to be all that remembered. But it's still significantly different from what is happening in Ukraine.
https://casebook.icrc.org/case-study/united-statesunited-kin...
https://www.hrw.org/reports/2003/usa1203/4.5.htm
As for Yugoslavia, it doesn't seem like "nobody cared", but it does feel like Western pressure led to some things not being prosecuted.
https://en.wikipedia.org/wiki/Legitimacy_of_the_NATO_bombing...
https://en.wikipedia.org/wiki/Independent_International_Comm...
https://en.wikipedia.org/wiki/International_Criminal_Tribuna...
edit: other poster linked to the ICTY investigation and it seems the bombings were of power distribution linked to military objectives: https://www.icty.org/en/press/final-report-prosecutor-commit...
There wasn't much infrastructure in Afghanistan to begin with, my point (as well as with the other examples I named) is rather that there haven't been many consequences for the war crimes that did happen - quite a few of which have been exposed by WikiLeaks and others, and quite a few of the perpetrators got pardoned by Trump or not prosecuted at all like the Australian units [1].
The ICC in theory is an awesome progress in the history of humankind, but it's ... a bit pointless to have when it's just ignored by those in power.
Also importantly, the ICC is a 'court of last resort' meaning it complements existing national judicial systems rather than replacing them. So in cases like the Brereton Report there's no need for the ICC to step in because the Australian judiciary is already handling the situation adequately. It's not a court in the traditional national sense.
Afghanistan for instance requested deferrals in the ICC's investigation of actions on its territory, with the ICC resuming the investigation only in 2022 after determining that the Afghan judiciary was neither pursuing its own investigations nor interested in requesting an extension of the deferral.
The ICC's jurisdiction is also dependent on various factors such as whether the alleged crimes happened either on the territory of a state party or were committed by or against one, and that's not always the case. For instance it only has jurisdiction over actions committed after 1 May 2003 in Afghanistan, as that was when Afghanistan became a formal state party to the ICC Treaty.
At least in the case of Serbia though, an argument can be made that the NATO bombings back then were to stop a war of aggression in the first place.