In this case the imidazole works by attacking the TBS-Cl first to displace the Cl and make TBS-imidazole which is then more reactive than TBS-Cl alone.
As for your pKa question, yes matching that correctly is important, but imidazole would probably work in the second reaction as well. I think TEA is usually more convenient to use in practice though. However, another great catalyst for acylation reactions is 4-(dimethylamino)pyridine (DMAP), which works very similarly to imidazole in the TBS reaction. In general for pK2 matching, you just need to make sure that the conjugate acid you are making is sufficiently less acidic than whatever acid you are generating. In this case, the acid is HCl, so most any base will work. TEA is quite a bit more basic than imidazole though. One reaction where pKa matching is particularly important is the Mitsonobu reaction.
For the solvents, I think the key is the difference in the rate determining step of the reaction. For example, in the TBS case, since the silicon is somewhat hindered, you need dipolar aprotic solvent to accelerate the nucleophilic attack of the imidazole (or alcohol) at the Si. In the second case with an acid chloride, the nucleophilic attack is much faster and you really just need to drive the equilibrium of the reaction, so solvent is so necessary to accelerate that step of the reaction. This might be another reason to use a stronger base in the benzoyl chloride reaction: to drive the equilibrium toward products. If you were to use TEA and DMF then the resultant ammonium salt would be a lot more soluble, but in THF that particular salt is pretty insoluble, which also drives the equilibrium. As for the particular nature of the solvents, THF is polar, but it's not really in the same league as the dipolar aprotic solvents like DMF and DMSO. Check out their relative dielectric constants. A high dielectric constant generally means that the are better at stabilizing a polarized transition state (like the intermediate in an SN2 inversion).
Benzene isn't really as bad as it's made out to be, but you are right that toluene is a lot safer (practically non-toxic). I'm surprised that your reaction would work in benzene, but not toluene. It really should. I would stick with the solvents you listed above, DMF and THF, respectively. Those reactions are highly optimized and those conditions are really reliable. You can also use CH2Cl2 for the benzoyl chloride reaction as well, however. Again, THF is better because the triethylammonium salt is so insoluble.
I hope all that is helpful to you.