Let's just say I am asking for a friend.

If they were to get their name of their British passport changed and visited countries outside the EU. Would their customs have record of their old name plus any other details from their passport?

Passports contain basic text information e.g. name, birth city, d.o.b. I understand that. Changing the name, easy, obviously people can't physically see the old name.

... but the concern is when a customs official scans the passport electronically, what data are they presented with? Would they have access to their old name and any other data?