Allowing this does not seem to conflict with any rules as written
Nothing in the ability description disallows it
the goblin chooses another goblin within 5 feet of it
The only two restriction are that the target of the ability be:
- a goblin
- within 5ft of the goblin boss
Jeremy Crawford even says that it can include PCs and other non-allied goblins:
The goblin boss's Redirect Attack doesn't specify whether the affected goblin is a friend or foe. It works on any goblin within 5 ft.
So, using the ability against opposed goblins does seem to be the intended reading as well.
So, nothing in the wording of the ability itself prevents this from targeting any goblin PCs that happen to be attacking.
You can attack yourself
You are a valid target for your own attacks mechanically speaking, per Jeremy Crawford:
The rules for attacks apply no matter whom you attack (see "Making an Attack," PH, 193). A DM might give you advantage to hit yourself.
Rules for attacking and targeting yourself are the same as for targeting other creatures, so there is nothing along these lines that would prevent something like this from occurring.
It does conflict with common sense however
Would switching places really make you hit yourself?
Note that the main mechanism for the target switch is the changing of places with the intended target (the goblin boss). This makes sense when thinking about switching with any goblin around the boss that is not the one attacking, but really does not make any sense for the case of switching with the attacker themselves though.
Consider this case:
A PC-goblin attacks the goblin boss at 5ft range with a crossbow.
Does it make sense that the goblin boss would be able to swap places with the PC in such a way that would result in the PC targeting and hitting themselves with a crossbow bolt? If the picture is that the bolt has already been fired, then this swap has to take place faster than the speed of a traveling crossbow bolt.
It might even make less sense in the case of the goblin trying to stab the boss with a dagger that somehow turns around and targets the PC when the boss switches place with them.
Obviously D&D is not a simulation, but results such as these would be very hard to describe narratively in a way that makes any kind of sense.
Some indirect support that this may not be an intended use comes from a somewhat similar ability from the Way of the Drunken Master Monk:
Redirect Attack. When a creature misses you with a melee attack roll, you can spend 1 ki point as a reaction to cause that attack to hit one creature of your choice, other than the attacker, that you can see within 5 feet of you. (XGtE)
Being a similar ability whose purpose it is to redirect attacks it seems significant that it prevents the redirected attack from hitting the attacker.
In a way, allowing the redirected attack to hit the attacker would actually make more sense for the monk ability than for the goblin since they are not switching places. And the logic then becomes even more compelling for imposing this same restriction on the goblin boss' ability.
It just isn't fun
There are few things I can imagine being less fun rulings-wise than to force a PC to hit and damage themselves with an ability that I cannot even justify in fiction. It is not fun for me and definitely not fun for the player.
It seems that redirecting the attack is allowed by all the rules I can think of/find. However, I do not think I would rule it this way at my table because of the common sense issues and just the difficulties in making the narrative work. As always, the DM has the final say in the matter and they can choose whatever works best for them and their table.