Apple - How to charge MacBook Pro quickly from an iMac?
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.
Emphasis mine
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.
According to Apple the best way to charge your MacBook Pro is with the included AC adapter. They don't mention plugging into an iMac specifically, but based on your report of a long predicted charging time, I'm going to guess that iMacs don't put out as much energy over thunderbolt as the AC adapter.
According to this page on the Thunderbolt 3 Cable, it is definitely the iMac's power output, not the cable that is limiting the charging speed.