It was programmed into the game because if you knocked down several enemies in a row with a single turtle shell the points add up for every enemy. Like in 5-1. But, if they had ment for us to jump on the turtle on the stairs in 3-1 why didn't they program the number of live to go much higher. It is easy to bounce on the turtle several hundred times then jump in a hole or let time run out and do it again. So, if they expected us to bounce on the turtle in 3-1, how did they not see the number of lives getting so high. That is, why did they have it show sprites for over a certain amount of lives. It would have been easy to program in a lives counter that would be infinite. Of course, you could argue that they didn't want you to get too many lives.
I think it may not be a glitch, but may be sloppy programming.
I remember reading about it when the game was fairly new, but has Nintendo made any official comment on it.