The way a referee in the NBA would likely rule this would be that if the contact was accidental, it may be a no call if the contact was minor. If it was apparent that the offensive player intentionally chose to initiate this contact, then a foul would be called.
If a player's well-being was in jeopardy because of such of a play, and their knee or head was at risk, this could even result in a flagrant foul being called.
A lot of basketball rules, as many rules in life, are based on common sense. Basketball is a contact sport in which all players are not supposed to hurt the opposing players. In the event that a player performs an action that could injure another player, it's quite likely that it will be called a foul. This is especially the case if the action was intentional.