py4cytoscape now has an extra parameter on delete_duplicate_edges ... it allows edge direction to be ignored.
The overall flow of the function was maintained, but important changes were made to allow different definitions of edge equivalence, and performance was improved considerably. (On my PC, executing the old structure on 3000 edges took about 11 minutes.)
I recommend that the same changes be made to the RCy3 version.