“Honestly, kind of useless”
The title is pretty much the general consensus of the TF2 community when talking about most of the stock melee weapons.
Out of all the nine stock melee weapons, five of them are universally considered pointless, and should be swapped out the moment a better unlock for that slot comes along. They are the Bat for the Scout, the Shovel for the Soldier, the Fire Axe for the Pyro, the Fists for the Heavy, and the Bonesaw for the Medic.
The Bat, the Fire Axe, and the Fists are considered useless mainly because the primary weapons for the Scout, Pyro and Heavy are extremely powerful in close range. The Scout, with his array of Scatterguns, can quickly drop any enemy with a few well-placed meatshots. Even if he fails, the Scout’s great mobility generally allows him to get away from any fights that he can’t win, meaning that a desperate struggle with a bat is almost never going to happen.
The Pyro’s Flame Thrower and the Heavy’s Minigun are absolutely devastating up close. And since both weapons do not require reloading and have an extremely high ammo count, rarely is there a need to switch to your melee because you ran out of ammo. Aside for that, the Heavy in particular has difficulty getting into melee range in the first place, since he is extremely slow with no mobility options, so a melee for combat is useless for Heavy unless in Medieval Mode.
The Bonesaw is useless since it is a close-range combat weapon for a frail, delicate class with no offensive options and isn’t supposed to be fighting anyway. The Shovel is useless to the Soldier. While the Rocket Launcher is hazardous to the Soldier in close-range combat for rather obvious reasons, he can either escape using the Gunboats and rocket jumping, or fight back using the Shotgun.
Either way, since these five melee weapons are only good for direct combat, and the classes for one reason or another are generally not expected to engage in direct combat with them, they are effectively useless. Even in cases where direct combat with melee is an option, more specialized weapons like the Axtinguisher made the stock weapons obsolete. And in most other cases, other unlocks that provide utility purposes, like the Homewrecker or the Fists of Steel are just better than stock most of the time.
As for the four other stock melee weapons, the Engineer’s Wrench and the Spy’s Knife are tied to their classes’ core mechanics, that is building and backstabbing. The Demoman, who only has explosive weapons other than his melee, relies on his Bottle for fights at close range. The Sniper is in a similar situation, as his Kukri is the only reliable close-range damage source available to him. In these four cases there are good reasons for the classes to use and depend on their melees. Meanwhile, Scout and Pyro are meant to be close-range powerhouses, so their primary weapons outshine their stock melees in combat. Heavy is the same, with the addition of him lacking mobility making it difficult for him to use melee in a fight in the first place. Medic is never meant to be a combat class, and Soldier has better options during close-range encounters than to use his Shovel. Basically, how the classes function makes it impractical to use the stock melee weapons for combat, and since that is their only purpose, they are effectively useless.
And when unlocks for melee came out, they are balanced relative to stock, with upsides and downsides relative to them as well. Problem is, when you don’t use the stock melee to begin with, the downsides are essentially meaningless, and you’ll basically get upsides for free. That is the case for weapons like the Ubersaw, Holiday Punch, and the Atomizer. For weapons that has on-equip downsides that affects the user itself even when the weapon is not active, like the Sandman, Pain Train, and Back Scratcher, it may still be judged to be better than stock because the upsides outweigh the downsides at that particular scenario. Thus, the Bat, Shovel, Fire Axe, Fists and Bonesaw will generally not see the light of day when an unlock to replace them comes by, unless you’ve been exclusively getting the Sharpened Volcano Fragment as your melee weapon drop.
I suppose, they can just be what they are in the first place: a backup when you have literally nothing else left. It seems like this can’t be helped.