Scripting can do anything you can do with the UI. This isn't something you can do with the UI, so no, you can't do it with scripting. If you change the colour of precomp1.layer1.simpleRectangleLayer then it changes for all instances of precomp1. That's how precomps work.
You'd have to make a script that would do the same thing you'd have to do with the UI—duplicate precomp1 to make precomp2, change the colour of the layer and replace the source of layer2 to precomp2. I did make a script that does this kinda. It lets you duplicate a layer and make a duplicate of its source so that it can be changed. Available (free, open source) here (caveat: there are some bugs I've never found the time to iron out).