Larian's gaming philosophy says the player can kill any NPC in the game and still move forward within the game and complete any quest or goal. And yet, if a player chooses to favor melee over everything else in how they handle combat encounters, that's where Larian draws their line and says to the player: no, you can't do that, and we're going to punish you for it? Seems entirely arbitrary, cussed even (though I will admit I'm not completely sure that's what Larian intends for the game, versus whether it's just your interpretation of Larian's approach to combat).
There are very real limits on what a class can and can't do in D&D 5E and thus BG3. If I make a prominent melee character, say a fighter, and my weapon is sword/shield then any and every attack I make must be within 5 feet of my target to make an attempt to hit them. If I become an eldritch knight at level 3 then I gain cantrips and the ability to cast spells, increasing the options available to me.
Rogue and Bards tend to be able to do the most because they are the two classes that have the most skills. D&D combat has some pretty rigid rules for what is and is not allowed, so a melee attack has to follow those rules.
"I used my last magic poo to check in on my daughter." Scanlan Shorthalt.