I went to my local Apple store to buy a replacement power cord. Incredibly, they don't sell them. This is bizarre. Apple sells all kinds of cords in their stores so you'd think they'd have something as mundane as a replacement power cord for an iMac. Nope.
I ordered the replacement cord using the link provided by kaz-k. The cord I received is, indeed, the Apple part, not a third-party knock-off. It has Apple markings identical to my original iMac cord. Even though the Amazon page says it's for "Late 2012, Late 2013, and Mid 2014 iMac," it's indistinguishable from the cord that came with my 2017 iMac.
Thanks, kaz-k!
(And Apple, please make your power cords less delicious so my cat won't chew on them anymore.)