The short-ranged 'slash-wave' solution I can respect. All things considered that would be the easiest way to circumvent the problem, but I believe the methods I put down have got their own merits, basically dissolving down to gameplay variety.
I guess the higher-damage thing was also a bit implicit. Spending hours trying to deflect incoming attacks and attempt lunges isn't a great idea yes, so ramping damage up to make each of those risky dives in count would be a good idea - I mean, after all, a Solar Armor lunge does a pretty respectable chunk of damage. Having a hitstun also inflict a defense debuff might be desirable.
As it is though, the package described up there I think balances the playing field fairly well, provided we don't count the slew of 'ranged-melee' attacks that exist. Ranged builds are limited by ammo supply, Mages are limited by their magic regeneration and mana pools, Melee (in a perfect situation) is limited by technique and timing, managing cooldowns you have on your abilities. Taking the faux-melee weapons into account, everything just gets convoluted because the only real downside stuff like Solar Eruption and Yoyos have is their slightly limited range, and that aside they are both extremely easy to use, do loads of damage, and use up no ammo, magic, or other resource. But theoretically (and this is why I made some distinctions between 'true' and 'partial' melee on stuff like emblems) most of the finesse involved with making close-melee swings so versatile and deadly is lost on those sorts of weapons. In a much more succinct way: Ranged and Magic require you to (generally) know how to aim your mouse cursor to hit enemies on target, but melee focuses much more on when to click instead - which is kind of like how melee worked in Terraria before more updates occurred, but it just got a bit lost between expansion of boss AI and fancier ranged weapons.
I can see where you're coming from with enemy AI. If you consider the closest equivalents to this game when it comes to 2D combat (Probably Castlevania - On-contact damage, timed weapon usage, etc), Ranged weapons in those games tended to be actually somewhat inconvenient to use since you couldn't aim anything - as well as limited uses, so generally melee is the default in that situation. More generally I think the biggest differences I can think of between Terraria and a battle-oriented Metroidvania is that the sprites in Terraria are way smaller, and movement precision is a lot less fine than it is in a game like Symphony of the Night - One's engineered for players to properly walk up fairly near to an enemy and smack them in with Crissagrim. You can control precisely how far you walk forward, stop on a dime before a fairly large target, and then strike at them without much fear of them suddenly lunging forward, because most axe knights and rifle skeletons usually didn't do that.
But for all I know, the solution could be as simple as causing zombies and other generic enemies to pause and then make a short dash across the ground at you when they get nearby? The key to making enemies work in those games is that, after you saw them a few times, you generally had an idea of how they'd move and attack. And some of the later mobs you encounter, stuff like Giant Cursed Skulls or Red Devils, that predictability is what can be used to avoid curses and immense damage from very slow tridents. What if that sort of principle was applied to even some of the earlier mobs? Who knows how it could work out? There'd of course be the issue of other unpredictable situations (a zombie walking off a ledge and dropping on top of you for example), but then is that something else that could be worked out by adjusting how enemies spawn or move?
Getting back to how melee and ranged relate in ye old Castlevania; for just a short while, Terraria melee also is the fallback! You always have to start out that game with nothing but your tools and a copper shortsword. But what's to stop that from developing into seeing what neat things can be done with it? It might seem niche, but provided the changes are introduced on weapons as globally as even your starting weapon, there might be some sort of draw to use the melee layout - provided of course stats like damage are ramped up properly over the course of the game instead of starting way too overpowered or again failing to match up to fake melee or the ranged options.