This line counting crap again? It was a contractual thing that Shatner's agent got him. It all traces back to Jonathan Harris on Lost in Space. Harris was cast in a supporting role, but his performance quickly elevated him to being the star. The nominal stars, Guy Williams and June Lockhart, soon found that they had small supporting roles on their own show. It was humiliating.
The agents of every leading man in Hollywood took note. Nobody wanted their client to be the next Guy Williams. So they asked for contract clauses promising that no one in the cast would get more lines than the star. Put it in writing. When Nimoy's character took off and his role got bigger, Shatner had to go through each script to ensure it was in compliance. He didn't want to get bulldozed by Spock's popularity.