You can't create an Illustrator script which alters the core code base of the application. Essentially, that is what would be required to remove a color or otherwise alter the list of available layer highlight colors in Illustrator. So what you are seeking is impossible, even for a script.
Okay, you could write some malware script to alter applications, but that's a different matter entirely.
Over the years tons of users have suggested the yellow be removed. And really, just as many have wanted to keep it. It has also been suggested often that users be allowed to alter that list. But if you think about it, what alteration would there be other than to NOT use a specific color? I mean the list has a wide range of colors already and it allows you to select a custom color if you desire. So, I speculate that Adobe doesn't feel the ability to change the default list of colors is an area worthy of development time and money. I kind of agree with them on that. You can choose the color assignment. You just can't alter the fact that it uses the next color for the next layer created.
For my money I find black a much worse highlight color than yellow will ever dream of being. I have always found yellow exceptionally useful when working on "darker" files. So I personally don't get the witch hunt against the yellow. It's no better or worse than any other color (except it's better than black) and depends upon the color of the artwork being worked on.
If you wish to use one color for all layers, or even just change the highlight color for several layers to be common, you can do that easily. Just highlight all the layers in the Layers Panel then choose
Options for Selection from the Layer Panel Menu.
You can then pick a color and all highlighted layers will change to that highlight color.
That's about as good as you are going to get.