Follow-up question to Where does the taskbar get grouped button titles from?:
Where does the taskbar get grouped button icons from?
The icon for grouped taskbar buttons comes from the icon for the underlying EXE, the same icon that appears when you open the folder that the EXE resides in and scroll down to the EXE.
For example, if you have multiple Explorer windows open and the taskbar buttons get grouped, the icon you get for the grouping is the Explorer icon. The system doesn't try to merge all the icons for the individual windows together, one of which might be a hard drive icon, another a Control Panel icon, another a folder icon, etc.