The different levels of Shimano groups all have different features. One of the features of the high end stuff is that the cage is wider and the over shift is a little more to make up for it. An XT derailleur may fix it. If it's a new bike take it back to the bike shop and check with them. It's possible you need the shifter to go with it, that's where the control for the position of the rear der. is. That may not be worth the money.
If you can live with it just don't ride in those combos. Most all low end groups have that exact same thing happen. It's typical. It is still possible the bike shop may be able to improve things.
All the Alivio bikes I have seen, including the one I own
rub in some combinations. The XT and XTR bikes can be made to not do that in most cases.