That is because before 1902 when the ball went out of bounds, the first player to retrieve it and throw it in was in possession. So cages had to be put up around the court to prevent the out of bounds portion of the game devolving into exactly what you describe.
The late Joel S. (Shikey) Gotthoffer, a star during the 1930s for the famed Philadelphia Sphas who also played for Nanticoke in the Penn State League, once said, "I played the first few games at Nanticoke in a [rope] cage, and I came home with the cage's markings on me. You could play ticktacktoe on everybody after a game because the cage marked you up; sometimes you were bleeding and sometimes not. You were like a gladiator, and if you didn't get rid of the ball, you could get killed."
The late J. Emmett (Flip) Dowling, a 6'1" center in the New York State League in the early 1920s, said, "It was common practice if the man with the ball was near the net, you would grab the net on both sides of him and press him into the net so he couldn't pass the ball and they'd have a jump ball."
Rody Cooney, who had played in several different eastern leagues, had this to say about dribbling methods in the early 1920s, in an article he wrote for Sport Story Magazine in 1931: "A hard dribbler could...rush through an entire defensive team, bowling over his opponents by various means—a favorite one being that of butting the opposition [with your] head. In this particular case, the dribbler butted—but he didn't look very carefully and butted his own man, who had stepped in the way. This man toppled backward from the ferocious charge, hit another player on his own team, and the three men fell together, knocked out by the hard impact. All three men on the same team!"
https://vault.si.com/vault/1991/11/11/when-the-court-was-a-cage-in-the-early-days-of-pro-basketball-the-players-were-segregated-from-the-fans