On corner entry, you are specifically supposed to leave space if there's an overlap.
In both cases this year, the drivers were defending a corner exit when the hit/near-miss occurred. A corner exit is a bit different.
In Rosberg v. Hamilton, Nico's move towards the inside line is unnatural, but he began it before Hamilton had any overlap, so he had the right to it, as well, and it was Hamilton's job to back out. The stewards ruled it a racing incident as the timing was so tight that they judged neither of the drivers had time to react. If they did find that there was time to react, that would be Hamilton's fault, because Rosberg's move right was telegraphed well ahead of time and was very deliberate.
In Hamilton v. Ricciardo, the leading driver on the inside line, as long as he has track position, has the right to run out to the edge of the track, which Hamilton starts doing before there is any overlap. It's the following driver who has to back out. This has always been the case in F1, whether there's a wall or run-off on the corner exit. Rosberg has done this as well, on occassion. It's aggressive. It's dangerous, it's not something I've ever seen the stewards penalize.
This is why the crash between Nico and Lewis in Spa 2014 was so controversial... on one hand, Lewis had a full overlap going into a corner entry, on the other, Nico had the lead coming out of a corner exit (on two linked corners). It was a notorious non-call, especially considering Nico had Lewis right up alongside him, but those are the breaks, sometimes.