it is a law, not a rule
in the case you outline above the decision should be not out (he was protecting his wicket) and dead ball - no runs.
In this case Law 34.
1. Out Hit the ball twice
(a) The striker is out Hit the ball twice if, while the ball is in play, it strikes any part of his person or is struck by his bat and, before the ball has been touched by a fielder, he wilfully strikes it again with his bat or person, other than a hand not holding the bat, except for the sole purpose of guarding his wicket. See 3 below and Laws 33 (Handled the ball) and 37 (Obstructing the field).
(b) For the purpose of this Law ‘struck’ or ‘strike’ shall include contact with the person of the striker.
2. Not out Hit the ball twice
Notwithstanding 1(a) above, the striker will not be out under this Law if,
(i) he strikes the ball a second or subsequent time in order to return the ball to any fielder. Note, however, the provisions of Law 37.4 (Returning the ball to a fielder).
(ii) he wilfully strikes the ball after it has touched a fielder. Note, however the provisions of Law 37.1 (Out Obstructing the field).
3. Ball lawfully struck more than once
Solely in order to guard his wicket and before the ball has been touched by a fielder, the striker may lawfully strike the ball a second or subsequent time with his bat, or with any part of his person other than a hand not holding the bat.
Notwithstanding this provision, he may not prevent the ball from being caught by striking the ball more than once in defence of his wicket. See Law 37.3 (Obstructing a ball from being caught).
4. Runs scored from ball lawfully struck more than once
When the ball is lawfully struck more than once, as permitted in 3 above, only the first strike is to be considered in determining what runs may be scored.
(a) If on the first strike the umpire is satisfied that
(i) the ball first struck the bat
or (ii) the striker attempted to hit the ball with his bat
or (iii) the striker attempted to avoid being hit by the ball
the batting side shall not be credited with any runs but any penalties that may be applicable shall stand except that a penalty under Law 41.3 (Protective helmets belonging to the fielding side) is not to be awarded.
(b) If the umpire considers that on the first strike none of the conditions in (a) has been met, then no runs or penalties will be credited to the batting side other than the one run penalty for a No ball if applicable.
5. No runs permitted from ball lawfully struck more than once – action by the umpire
(a) If no run is attempted but the ball reaches the boundary the umpire shall call and signal Dead ball and disallow the boundary.
(b) If the batsmen run, and
(i) neither batsman is dismissed and the ball does not become dead for any other reason, the umpire shall call and signal Dead ball as soon as one run is completed or the ball reaches the boundary. The run or boundary shall be disallowed. The batsmen shall be returned to their original ends.
(ii) a batsman is dismissed or for any other reason the ball becomes dead before one run is completed or the ball reaches the boundary, all the provisions of the Laws will apply except that the batting side shall not be credited with any runs, except the penalties permitted under 4(a) or 4(b) above as appropriate.
6. Bowler does not get credit