Originally the electrics were taken off the train at Nuneaton or Bletchley.
Until recent years it was a requirement that the pans on electric locos were padlocked down before they were allowed to go off electrified lines. In any case the fleet was needed under the wires because there was a shortage of electric locomotives. In the 70s I recall tales of F/liner and similar trains standing for hours and sometimes days waiting forward power.
The first electric to operate out of St Pancras was the 86229 in 1983 after it had been named "Sir John Betjeman".
St Pancras to Bedford was apt, as Betjeman had worked tirelessly in the 1960s to save St Pancras from Closure.
By the time DVTs were introduced, the locos used to stay with the set, so it made sense to leave it on and haul the whole lot across to Bedford, and let them run electric from there. The locos of course had been modified so that they could run dead at the rear of the train by then of course.
Prior to that the loco would have had to have been shunted out at St Pancras and put DIT leading out.