My God, pols debated whether to ban Trump! They did that not necessarily because they had the guts to do it but to send a message to America not to vote for this guy. British pols are always mouthing off about American policies to influence American policies. Let’s not be naïve.
They had to: parliamentary procedure. After the online petition triggered a certain level.
Look, we all know that Obama wants Britain to stay in the EU because it is in America's interest that Britain is in. It is inevitable that a certain amount of US pressure is going to seep into the debate, but it's very unusual for a foreign political leader to directly advise the citizens of another nation to "vote for such and such a person" or "not to vote for such and such a treaty", at least in the terms that Obama used.