Well there's no magic to it. Not sure if all of this can be done in Tasker, but there might be some possibility.
Every cell ID contains a 5-digit MCC+MNC code. First three numbers are for country (Mobile Country Code), last two for network operator (Mobile Network Code) - the whole list you can find at
www.mcc-mnc.com . Strip that number out of the cell ID (can Tasker truncate strings?), and you have the carrier code of the tower. Match this against your favourite carrier, and connect to that tower.