It may not have been smart by Xhaka, but he was entirely justified to tell the fans booing him to go forth and multiply. They are the guilty party here and he doesn't need to apologise. Why should he take it? If my clients booed/insulted me whilst doing my job I'd tell them where to go as well. Saying he abused the fans is laughable.
The only reason that it isn't smart is because its not good for his career; nothing to do with the right and wrongs of the situation.
Because quite simply, 'the fans' are not a single person - whereas Xhaka is. Again, you are right in a vacuum, but this is football and I do agree he was justified to be frustrated and tell the fans to fuck off. But looking bigger picture here, you can't punish 'a fanbase' - even if you're talking about 0.01% who is actually doing this sort of thing. Sure, you can start removing fans from the ground for booing people, but then you start banning users online who abuse them, why not remove comments who are negative too? At the end of the day reacting against the fans rarely goes well for a player, even if it's the right choice in the moment to say 'I don't deserve this moment'.
In many ways it is a lot like tailgating the person who cuts you up and sticking your fingers up for them to see in the mirror. Sure, they're in the wrong - your actions are justified, right? But you're still acting the idiot.