This issue has been resolved for me, but I don't know how.
iMac Retina 5K, 27-inch, Late 2015 - macOS 10.12.5 (problem appeared after installing 10.12.4)
AMD Radeon R9 M395X 4096 MB
40 GB RAM (2 x 4GB from Apple + 2 x 16GB from OWC)
2 additional 4K Samsung U24E590 displays
I was getting ready to file a bug report as hmbay suggested, and performed the following steps:
1. Ran sysdiagnose with the system working (i.e. all displays working properly) with energy saver preferences as follows:
* Turn display off after - Never
2. Changed energy saver preferences as follows:
* Turn display off after - 10 minutes
* Prevent computer from sleeping - Unchecked
3. Waited until the computer went to sleep, then woke it up with the plan to run sysdiagnose again with the main display off... but the main display (and the two external displays) came on as they should.
The iMac has been working correctly for 4 days now.