Well, the shifter turns rotary movement of the level into linear movement of a cable. The "piece that comes off the side of the hub" is the bellcrank mechanism that translates that cable movement into the plunge required to slide the gear engagement back and forth. If you think about what the parts actually do and how they move, you'll realize that what you're asking for isn't real practical.
Now, you could potentially put the shifter just ahead of the bellcrank, thereby preserving the correct movement of components, but for a shifter to work mounted right on the axle end, the shift lever would have to travel side to side instead of front to back. It would be upright in second gear, and pointed either at the wheel or out to the side in the high and low. Or, I suppose, you'd have to devise a linkage or maybe have an awkward looking cable loop around somehow...