You asked who was legally responsible. I never said it was a Solicitor, so I don't know why you went that direction.
It's the Landlord "in the chair" who is legally responsible. If they had an Agent then you can say they
should do things pertaining to the Deposit, but they're not legally responsible... and they're likely crap and disinterested.
Think about it - it can't be the Landlord
buying the property... they have no ability to "pull" the Deposit. For the same reason it can't be their Agent. It can't be any side of Conveyancing as they'll likely unaware and - as you've been told - they don't do that anyway.
We've ruled everyone else out?
Well... the Tenant... but it's 100% not them.

So it's the Landlord who owns the property at the time of sale... they're the only party who has the ability (never mind the responsibility) to do anything with the Deposit (their Agent
could manage it on their behalf, obviously... but still not legally responsible - it's the Landlord).