With "old" method under X11 the icon was just a tiny window the application created that was then embedded in the tray window and you could do basically anything with it. This caused problems with transparency though so for the sake of a prettier desktop (and because this approach would not work with Wayland) we got a more limited D-Bus protocol where you only get an icon and a menu.