The tray icon currently works like this: If the PH window is visible, the icon click hides it. If the window is hidden, the icon click shows it. That's pretty simple.
When the window is visible but completely covered by other windows, it is easy to forget about the PH window being visible and you click on the tray icon to bring it up. But now, the first time nothing happens because the visible but covered window is now hidden. Only the second click shows and activates the window.
I'm not sure whether Process Explorer does that, but I think I've seen it on other applications already: If the window was not previously active, it shall be activated (and shown if it was hidden). Only if the window was active, it shall be hidden.
Implementation details: I know that clicking the taskbar steals focus from the application window, so you cannot evaluate the active state in the moment of the click event. I think it could be best to remember the time of last deactivation of the window and compare it with the tray icon click event (or maybe better: tray icon mouse down event, because a click can last longer). If that time is shorter than say 100 ms, consider the application window active at the click time. This should only apply if the window is also currently visible.