> it was only ever leased from China
Only part of Hong Kong, the New Territories, was leased from China. Hong Kong Island and Kowloon were ceded to the UK in perpetuality.
The UK didn't have to give them back but it also didn't have a reliable fresh water supply for such a large city that didn't depend on mainland China.