Why paint a British roundel on a non-British Lynx? In recent years, some of the Westland Lynx helicopters of the Portuguese Navy have undergone some form of mid-life update (MLU) in order to have their engines and avionics upgraded. Also, allegedly, a few Portuguese naval aviators have undergone training and qualification on these updated Lynx helicopters.  Allegedly, such work took place at Leonardo's site in Yeovil, Somerset, England, United Kingdom.
Interestingly, articles on the aforementioned events do display photographs that show a British roundel alongside a Portuguese roundel on Lynx helicopters of the Portuguese Navy. The following photograph shall corroborate my claim.



Question
Why would one paint a British roundel on a non-British Lynx?
At the moment, only two hypotheses occur to me:

Though the aircraft being upgraded do belong to the Portuguese Navy, the test pilots are British.

If a trigger-happy fighter pilot in his pretty Typhoon passed by, he would know that the Portuguese Lynx is in British airspace with the permission of Her Majesty's Government and that Albion's oldest ally is not actually invading Old Blighty. Thus, it should not be shot down.



References
On Portuguese Lynx helicopters with British roundels:

Marinha Portuguesa, Helicóptero da Marinha Portuguesa realiza primeiro voo após processo de modernização, 18 de fevereiro de 2020. [Google's Portuguese-to-English translation]

First flight for upgraded Portuguese Lynx (2020)

Portuguese pilots in UK for Lynx Mk95A (2020)


On Brazilian Lynx helicopters with British roundels:

Leonardo: upgraded Brazilian Navy Super Lynx makes successful maiden flight (2017)

Third Wild Lynx for Brazilian Navy (2019)

Brazilian Navy completes Super Lynx Mk21B acceptance (2021)
Best guess; the photos are from the delivery flights in the 90s. The helicopter in the photo has the same registration as when it was first delivered (ZH583) and has not been active since. 
Update: Although I'm having problems finding an authoritative source, it looks like the registration was resurrected for test flights post-upgrade. Mark Youd has taken a few photos of ZH583 recently(flickr), it was listed in the April update from a site called &quot;Military Aircraft Markings&quot; and looking at various planespotter forums and various flight tracking sites(1)(2) you can find multiple reports of flights being undertaken using the original ZH583 registration.
The roundel and registration is temporary and easy to remove, but was required for the test flights in the 90s as well as prior to delivery post-upgrade. Looking at other photos you'll see the Portuguese registration on the tail; on your photo this area appears to be covered up to avoid having an aircraft with two different visible registrations during test flights.
As for your hypothesis; the second is totally off target. There are loads of barriers in place to avoid having any situation involving a trigger-happy fighter pilot, such as predefined rules of engagement and procedures civilian and military control centers follow.
My guess is that the first one is closer to the truth; although I haven't found a source for it, I can imagine that it would be easier for the factory and the test pilots undertaking the upgrade and test flights to schedule and log flights using the UK registrations.