There are a bunch of ways to measure gain of a transistor, current gain, voltage gain, transconductance gain, and more. They are all nonlinear to different extends but it doesn't matter.
Transistor amplifiers are almost always used with feedback. Even simple emitter degeneration is a form of feedback. Feedback linearized the circuit and so the secret to good linear behavior is lots of feedback. That requires lots of gain. So transistors male good linear amplifiers not because they are inherently linear but because they have lots of gain.