Hey Mackelsaur,
By no means would I consider myself a programmer so my knowledge of the field is very limited. What I am doing is very basic and what you outlined, from what I understand is in fact what i'm doing. The "Attached parts are being added to an array" once they are dissassembled, they automatically leave the array. Let me know if I missed something from what you said. The issue comes where I'm doing boolean checks to make sure certain conditions are fullfilled before connection or disconnections. Sometimes the booleans don't fire or I didnt set it up properly so there would be conflicting logic that null a command.
What I use, mainly, is Unreal Engine 4's blueprint system. I don't write any "code" per say. Not yet. I'm still learning C++.