First off, any side to side movement or change of lines in the braking zone is just plain poor racecraft. 1 move on the straight is allowed from corner to corner. Example, you come out of a corner that you late apex'd, and you post up on a centered or inside line off the corner, you can make a move to the outside or further inside (depending on situation), but you cannot wait to til the batking zone to do this, nor can you make a 2nd move which then constitutes blocking. The idea, is as a lead car, you can choose your line on a straight, and change that one time prior to the braking zone. Now, if any part of a chasing car is next to the lead car, the lead car is expected to afford the chasing car his line.
As for cornering, proper racecraft expects that an attacking car must establish proper overlap prior to turn in (the point that the lead driver makes his final commitment/movement to the corner entry). As long as the chase car's nose is up to the driver position of the lead car, it is expected that the lead car afford the other space for their line without contact or minimal contact.
In regards to your reference of a driver coming in underneath, it is his responsibility to hold his line and not press out into yours. A little bumping/rubbing os to be expected, but it should not take you off your line...if so, it is an infraction and poor racecraft. Sadly, GT7 does not penalize under these pretenses, therefore, you need to drive with this in mind. On Sport mode where these moves are prevalent, I deliberately post my car up on the deep inside on the straight. Sure, it slows my speed around the corner overall, but I am legally defending the inside line on the straight and into the corner....just be sure not to move out wide in the braking zone, as that in itself becomes poor race craft. By holding the inside line, you force the opponent to go offline and where he doesnt want to go, and places the burden of risk on him. That is legal defending, but also be ceratin not to drift out on him...hold your line. If he is able to round you on the outside, you must leave the car's width of track space on the exit for him....but if he executes the overtake, hats off to a clean and respectful pass...and well earned.