It doesn't seem fair to team A to be penalised for the action of a team B player.
Then don't put the kickoff so close to the sideline!
Free kick rules are designed to encourage runbacks, which is why there is such a severe penalty for kicking the ball out of bounds (spot at the 40, although, statistically, this is not a "penalty").
Sure, the kicking team wants to give as little chance to the receivers as possible by kicking the ball toward a corner, but if you do, this is a chance you take.