First ...
Lets agree we will actualy read what the other say, bcs if we dont... there is really no reason to pretend this is a dialogue, we can aswell each imagine that conversation in our head and be done with it, ok? :-/
So you're telling me you'd divert your forces to attack the group that is attacking your enemy on sight without confirming their intentions are hostile, PURELY because one of them is a goblin?
First of all, what im saying is that you are "a Tiefling" ... you have no forces to divert, you have one action in your turn and one arrow you can shoot, thats all you have.
My question was how would you use it.
Second ...
There was no time to confrim their intentions ...
As i said: They JUST, and i repeat once again to be sure, JUST appeared ...
No action were made just yet ...
And nobody who have at least a hint of self-preservation ... will (in my honest opinon) wait for another non-friendly looking character on freaking battlefield to state their intentions. xD
And finaly third ...
Party i described ... maybe i repeat it ... is:
A Githyanki ... ugly alien being, you may (or may not, w/e) heared Zoru talking about as it kills his friend(s? ... not really sure if there was multiple of them) ...
A Elf ... if we would presume you have really high perception ... its an oddly pale elf, with bloody-red eyes, fangs, and bite-marks on his neck ...
A Half-Elf ... that is wielding armor full of Shar symbols ...
AND another Goblin ... since, as mentioned previously, all your character see in roleplay (and this is roleplay perspective question) is how do you look ... so you dont really know if its same tribe, different tribe that dont really likes them, if they are in open war, if they are looking for alies, or whatever else ... its JUST A GOBLIN ... another freaking Goblin in situation where lots of freaking Goblins is attacking your freaking camp.

So ... no, certainly not "
PURELY because one of them is a Goblin". xD
More like bcs litteraly none of them looks like someone i want to have anywhere near me.

Now ...
When (as i hope) situation described by me was explained enough lets look at yours:
That's... Not the most tactically sound decision a commander can make.
Isnt it?
We are talking about world where even smallest child know that shits like Fireball exists ... and that even single Fireball can easily massacre half batalion with ease.
Now ... even that small child know well enough that casters, usualy stay out of main battleground, bcs they are fragile ...
That small child also know that there are healers, or people who are using power-incerasing magic, who aswell often stand in back hidden behind their meele troopers ...
And finaly ... the same child is since his young age taught that Goblins are treaterous bastards, who dont hesitate to slit each other throat if that suits their needs.
So ...
Lets say you are not "a Tiefling" but "Zevlor" ... and you are actually comanding your troops (also something he dont really do during that defense) ...
You notice group of not really friendly looking individuals appearing on the hill at battlefield ...
Their position gives them advantage (not mechanical one) ... if they decide to interfere, it would be a lot easier for them to kill your ground team, you are trying to save ...
They are in range for your archers tho ...
What would seem more tactical to you?

A) Wait what will they do ... aka bother with lowly goblins and hope those clearly more dangerous figures will be friendly.
B) Pre-emptively attack most dangerous target.
I know what i would pick. :P
Even tho, i agree it would be best if Zevlor could somehow yell at us to state our Aeligance.
You probably just got all your troops killed attacking a group you didn't necessarily need to fight while actively protecting the group you KNOW wants you dead.
See this is exactly the problem this game have ...
You are taking Aeligances under concideration ...
I know we can see wich NPC is green, wich is yellow and wich is red ... but that dont exist in roleplay (and should not exist in this game either).
This is just using of metaknowledge.
And i refuse to accept any argument coming from that, bcs situations should be resolved immersively by NPCs ... therefore they cannot know what "they didnt necessarily need to fight" ...
We have saying in czech: When battle is over, everyone is a general.

I'd pull back a bit and keep engaging the goblins I KNOW want to kill me
Cute ...
So you just transformed into Aradin now? O_o
Okey ... i guess ... there is little reason to talk about his perspective tho, bcs he have only 2h mace and can attack only those who are on Meele range ... but fine, have it your way:
How do you know wich goblin on that hill wants to kill you? :P
Feel free to replay the scene if you wish, or watch soem youtube video ... there is plenty of them.
Or you can just take what i tell you now:
Presuming our PC is a Goblin ... there are
3 of them on that hill! :P
then question the group that just came to my aid after the fighting is done.
See? Metaknowledge again ...
All you see is that someone came ... there is no garance of aid, people dont have banner "friendly target" over their heads.

You just cant get out of the game thinking can you?

If they turn around and attack me I absolutely fight back with no hesitation.
This is even funnier, bcs that is also something game even refuses to do ...
You can totally come to Aradin and attack him directly ... and he would still throw a potion at you next round. xD
You can be on your guard without killing people indiscriminately.
Never said you cant ...
Nor i ever said i kill everyone "indiscriminately" ...
Its just that as it seems our description of being "on guard" differs.

Besides, I play mostly rangers and druids. My passive perception is great.
Maybe ...
Even the most perceptive hero sometimes fail ... especialy in BG-3 where nat 1 means failing. :P
How can you tell wich group s/he belongs to? :P
Goblins are attacking your camp ... there is a goblin.
The same way I can differentiate between who is fighting alongside me and who isn't in Grymforge I suppose.
There is important difference ...
We are talking here about NPC perspective ...
NPCs in Grymforge made a deal with you, therefore they know EXACTLY who is in your party (unless you purposefully switch someone before that fight just to mess with logic) and therefore who is their aly.
So ... nope, different situation = false example, sory. :-/
I guess the game could stop telling players who is and isn't an ally during fights for the sake of realism, but I imagine most players wouldn't especially enjoy accidentally killing important NPCs in big fights when things get chaotic and you can't quite remember the names of the NPCs you met 5 seconds ago.
This is interesting proposition ...
I would say that if game would do that, it would also require adding some "hey same team idiot" bark ... or mid-fight dialogue (wich would be really weird in this cinemtic style Larian like so much) where your aeligance would be questioned ...
Anyway if you manage to forget name, looking and position of NPC you were talking to 5 sec ago ... you deserve to loose it. :-/