Is your script on github or anything?
The best I've come up with is to
1. Create the custom list
2. Move all the sets into parts, delete the sets
3. Export the custom list as rebrickable csv
4. Use the csv to "subtract" the parts from the parts list
5. Use the csv to create a new parts list
I know of no easier way using only the tools that Rebrickable offers.
When faced with a similar task of moving parts for a MOC into a new list, I originally proceeded as follows. With this approach, I could stop after any part and continue later, while the total of all part lists still accurately reflects the sum of my parts. (This was important for me, because I was working with loose parts I bought separately, not parts taken from sets I own.)
1. Have the required parts contained in a part list (I call it "donor list"). You end up there after parting out your sets as described in your step 1.
2. Have a custom list "My MOC CL" containing the required parts, and a new empty part list "My MOC" to contain the required parts.
3. For each part in the custom list, move the required number of that part from the "donor list" to "My MOC", like so:
3a. Click on the part to open its Part Summary, then go to My Parts.
3b. Find the "donor list" containing the part in the correct color. The cell at the intersection of the color and the "donor list" contains a link to the Part Summary of the part in that list.
3c. Click that link. You see the Part Summary with the "Edit this Part" tab opened.
3d. If the "donor list" contains the exact amount required, change the "List" field to "My MOC". Due to a bug (already reported in the forum), after saving the part you see the parts of another list, and you have to reload the page to see the parts of cour custom list again.
3e. If the "donor list" contains more than the required number of the part, switch to "Add Part to List/Inventory", put in the required number, select My Part List "My MOC", check "Keep Open", and "Add Part". Go back to "Edit this Part", calculate the remaining number of parts in the "donor list", change the Quantity to that value, and "Save Part".
Yeah... Quite a lot of work. Likely not faster than your approach. After doing this for 200 of the 400 parts in a MOC, I grew frustated with how slow I progressed (about 1 or 2 parts per minute).
Instead of continuing, I wrote a program that uses the Rebrickable API to perform the movement for me, which works exactly as described above. I extracted parts for several MOC using it. I don't like to share yet, as the program is undocumented and only intended for this specific use case. Learning the API was fun though, and helps me with my day job as well.
Another approach seems possible, which I did not explore yet:
Since one can export and import complete part lists and custom lists, it would be possible to write a program (maybe even using makros in a speadsheet) that performs the movement offline by modifying the downloaded part list files, and then you can re-upload the modified part lists.