Follow--up: did the Republic of China (Taiwan) come into the debate at all? Like, the idea that Britain would hand Hong Kong over to the ROC, rather than the PRC?
What do you mean by UK being surprised? The agreement about the fate of Hong Kong was signed in 1984, more than a decade before the end of the lease.
It's important to remember that the 99 year lease was only for the "New Territories", the parts of the Colony that were on the mainland and separate from Hong Kong Island itself. The British Colony on Hong Kong Island was ceeded to the British in perpetuity by the Qing Empire. So when the 99 year lease came up, the British were technically only obligated to give up the mainland portion of the territory. However the highly interconnected nature of the "New Territories" to Hong Kong Island made separating the two unworkable, and thus Britain negotiated to give the entirety of the colony (with some major political provisos) to the PRC. It's a fascinating topic.