I experienced this or a similar problem. I cloned my OS X 10.11.6 boot disk, a 1 TB SSD, to an external disk, reformatted the SSD, installed macOS 10.12.5 Sierra on it and migrated applications and data of several accounts from the clone. Two applications, iMovie and iDVD, displayed only the generic application icon in the dock, where they are fixed, as well as in the App folder accessed from the dock and in the Launchpad. Nothing suggested in this thread remedied the problem. However, when I clicked the arrow in the App folder accessed from the dock to display it in Finder, the correct icons were displayed there and everywhere else except in the dock. So I deleted the icons in the dock and moved new ones in from the App folder.
I believe the problem afflicts apps that I seldom -- perhaps never -- used on this machine. I have another MacBook Pro, the last 17" Unibody that Apple made, and upgraded it from OS X 10.11.6 to macOS 10.12.5 the same way. On it, it was the icon for Microsoft Outlook that was not being displayed. When I launched it for the first time after installing Sierra the problem cleared up. I have never used Outlook on my Macs, but on that MacBook Pro I have used iMovie and iDVD.