July 3 (Reuters) - Santander's plan to buy TSB for 2.65 billion pounds ($3.61 billion) and boost its position in the UK came together only a few weeks ago, after the Spanish bank had been considering a possible exit from Britain, three sources close to the process said. The lender, grappling with years of underperformance at its UK business and a market share that at best had flatlined, had this year been reviewing its two-decade presence in Britain.