Absolutely spot on, excellent advice !...Worth considering too, in your current predicament, is said client. If you leave Bob in the brown, who suffers? I tend to think that in all such conflict it is the client that suffers most. To that end I have, for the sake of not losing a customer and not giving Bob the opportunity to make me the scapegoat for everything else that goes wrong, swallowed the loss over such alterations, finished the job and made sure that the client has my direct details and that the next time Bob calls for some work, I don’t answer the phone.
Make sure the ultimate client knows why you are walking off the job, otherwise the builder will probably do damage to your reputation by saying you were unreasonable and wanted more than was agreed or was acceptable. Make sure the client knows that the builder is trying to make money or recover poor costing through trying to force you to do the work below its true value to cover his own short-comings.
You should offer to assist the client in helping to get the electrical work completed but explain that this will probably be extremely difficult given the attitude and abusive personality of the builder. If you are walking away personally I would tell the client that I was happy to pass on the requisite information to the replacement electrician so as to minimise cost to the client. That is a professional way to act, will put the builder on the back-foot, and will be appreciated by the client who will see you are on his side. That is a powerful place to be. And if you brief any incoming electrician/electrical company on the state of matters, you may find that the courtesy will get repaid in another way as you will be seen to be behaving with integrity.
I once had to do this on a large Contract (in not dissimilar circumstances). The incoming Contractor called me a while afterwards and asked if we would come in and support them on some work they were bidding for and needed someone with them they could trust. We made some decent money with them as well.