As Assange gets citizenship to Ecuador and becomes an official diplomat of the country, I'm wondering if there is any precedent for the UK to arrest him in that capacity for alleged transgressions that took place prior to assuming the post?
If the UK had accepted Ecuador's request to make Mr Assange an officially accredited diplomat, he would been immediately entitled to protection under the Vienna Convention, to which the UK is a ratified signatory. Specifically he would have enjoyed Article 29 which explicitly forbids the arrest of a diplomat.
The person of a diplomatic agent shall be inviolable. He shall not be liable to any form of arrest or detention. The receiving State shall treat him with due respect and shall take all appropriate steps to prevent any attack on his person, freedom or dignity.
This is also considered a part of UK law, in relation to the Diplomatic Privileges Act 1964, specifically article 2.5;
Articles 35, 36 and 40 shall be construed as granting any privilege or immunity which they [The Vienna Convention] require to be granted.
Given his chequered past, it's likely that the Ecuadorians envisaged that the UK would accept their proposal (allowing him to leave their embassy unhindered), then immediately exercise their rights under Article 9 of the Vienna Convention to declare him persona non grata and ask him to leave the country.
The receiving State may at any time and without having to explain its decision, notify the sending State that the head of the mission or any member of the diplomatic staff of the mission is persona non grata or that any other member of the staff of the mission is not acceptable. In any such case, the sending State shall, as appropriate, either recall the person concerned or terminate his functions with the mission.
Instead, the UK exercised its rights (under the same article) and simply declared his appointment not acceptable.
As to whether the pre-planned arrest of an accredited diplomat has occurred on British soil, the answer is that such a thing hasn't occurred for several hundred years. The last case appears to have been in 1717 with the arrest of Karl (or Carl) Gyllenborg, the Swedish Ambassador. His papers and person were seized when it became clear that he was part of a conspiracy against the Crown and he was imprisoned for five months before he was permitted to leave the country.
According to the Crown Prosecution Service's guidance on diplomatic immunity (emphasis mine):
Diplomatic immunity in the UK is conferred on all entitled members of a foreign mission (and entitled family members forming part of their household, provided they are not nationals of the UK) who have been notified to, and accepted by, the Foreign and Commonwealth Office (FCO) as performing a diplomatic function.
In other words, once the diplomatic status of an individual is accepted by the FCO, the diplomat can only be arrested with the permission of the sending state. Normally, this recognition of diplomatic status happens almost immediately when a diplomat enters the country using their diplomatic passport.
As has been reported by various media (such as the London Evening Standard), the FCO has refused Ecuador's request to recognise Mr. Assange's status as a diplomat, primarily because of the charges already outstanding against him. Because the FCO does not see him as an official diplomat, then he is subject to arrest and prosecution as any other foreign citizen.