This cable costs $39 retail. At this price I am expecting better
performance for charging than what I'm getting here. How could I
diagnose this issue?
There's nothing to diagnose because everything is operating as it should.
The problem is not the cable (it's irrelevant, actually) nor the iMac as it's only capable of delivering up to 15W of power via the Thunderbolt 3 ports. From Apple's Support Document.
Your iMac also has two Thunderbolt 3 (USB-C) ports....Thunderbolt 3 also supports USB 3.1 Gen 2 connectivity at up to 10Gbps, and can supply 15W of power per port to external devices.
Your MacBook Pro requires a 61W charger so, in essence, you're using a charger that can only supply a quarter (25%) of what you're MacBook Pro requires. Therefore, the long charging time is accurate and to be expected.
Bottom line - use the charger that came with your MacBook Pro.