I did some googling around. It looks like iMac displays are panels from LG, Samsung, possibly others, that use a standard interface (eDP, I believe). So (standard disclaimers apply), if you disassemble your iMac and find the model number of the panel, you can probably find a controller on Amazon, eBay, or elsewhere. You would also need a power supply.
Googling iMac lcd controller will turn up lots of hits, like this one:
If I remember correctly, and I may not, but I could of sworn ATP discussed it and it came down to the technology of how the 5k works on an iMac that made it difficult to do. So they decided to remove it instead.
Your prompt reminded me. The controller for the 5k monitor is actually treating the screen as two separate screens which are synchronised to allow the image to be displayed. I doubt there’s a simple way to directly control them as a single display.