Subtitles are an integral part of the film- and TV-viewing experience in the late 20th century in Hong Kong, Taiwan and mainland China, multi-topolectal or not. They essentially became ubiquitous in Hong Kong by the end of the 60s, as Mandarin-speaking and Shanghainese-speaking film talent and audiences flooded into Hong Kong, whilst dubbing was still deemed economically prohibitive. This became enshrined in law later in the PRC, but the culture of subtitling had already become standard across the Sinosphere, including Singapore where dubbing was also practiced.
However, there had already been a steady stream of Mandarin and Shanghainese-speaking film talent into Hong Kong during the Republican era, especially with Kuomintang restrictions on cinema, even before the exodus post-World War II and post-1949. E.g. the Shaw Brothers started their showbiz career in Shanghai, but set up their renowned Hong Kong studios in the 1930s. Indeed, the Mandarin film and TV industry is widely seen to have helped Hong Kong become a recognised cultural powerhouse across East Asia - one work even cites the 1938 Mandarin historical epic 貂蟬 Diāochán as having:
helped to establish the reputation of Mandarin Chinese cinema in a colony characterized predominantly by Cantonese culture.
Thus, in the mid-to-late 20th century and into the 21st century, Hong Kong audiences came expecting to read (good quality!) subtitles in film, even if not everyone actually 'needed' them because of individual passive listening skills in other varieties of Chinese.
Although a Taiwanese character simply 'understanding' the Cantonese of Hong Kong, like any trope, is an exaggeration, it can be instructive to explore why this became a feature of Hong Kong cinema specifically in the 1980s. Political and social changes in Taiwan, with increased mobility of certain Taiwanese citizens (including actually being able to visit Hong Kong), combined with an avid interest in Hong Kong cinema there, plus the rise of 台灣新電影 (variously called 'Taiwan New Wave', 'Taiwan New Cinema', 'New Taiwanese Cinema') with its own complex relationship with Hong Kong cinema, meant that there was increased Taiwanese representation in Hong Kong media.
Such a portrayal may also include a measure of linguistic savviness, with Taiwanese characters being able to understand a larger measure of Cantonese than one would expect from someone with no previous exposure - the implication is often that there is a certain shared 'affinity' (now we really get into characterisation: this can be attributed to shared political ideals, cultural habits, and even linguistic ties between Cantonese, Hakka and Taiwanese Hokkien) and even that there has been previous exposure to Hong Kong, to Cantonese, and to the local culture, through the power of cinema.