The water between Taiwan and China makes it pretty hard to invade unlike Ukraine or Hong Kong. It's how Taiwan came to be in the first place - the Chinese government retreated there to escape the communist take over and it's held for the last century. If anything modern tech had made things worse for an invading navy if the fate of Russia's Black Sea fleet is anything to go by.
Hong Kong was actually pretty defensible, it is hemmed in by mountains and then water. The problem is that all of Hong Kong’s utilities and food came from the mainland, it just wasn’t a viable city without mainland cooperation.