TMP36 is specifically a temperature sensor, not an NPN transistor like the 2N2222. You might have them confused because they both can come in TO-92 package. It might beis possible to look at the various properties of 2N2222 transistor and correlate it to temperature (see the other answers on this page), but that seems not practical for your application.
You will have to find a suitable alternative temperature sensor that "provide a voltage output that is linearly proportional to the Celsius temperature" with similar output to the TMP36 or try a different approach.