They aren't just about electrical safety directly, but also about not potentially confusing people in the future.
If the cable was black, then someone may not have known that it was an earth cable, and might have cut it, which would leave your electrical installation unsafe.
Thats the reasoning why using the wrong color for a wire can make it illegal.
It is only required to be "primarily green". So the common alternative of green with yellow stripe is also allowed.
You can reidentify black cable if it's large enough gauge (6 awg currently).
They must be > 6 awg to pull black and use green tape on the ends.
See 250.119.
This has been the case for a very long time though, at least since 2007 NEC. I don't have handy copies around for before then.
rimshot