Yes, I believe you are correct that under the tax treaty public sector pensions would be taxed in the UK.
But you will need to get guidance from a Tax specialist as not all public sector pensions are included.
Regarding qualitfication for Non Habitual Resident (NHR) Program, it is only dependent on you not being resident in Portugal for the previous 5 tax years, so if you meet that then you’ll qualify. However, you may not get any benefit if all your income is from a UK public sector pension.
Keep in mind the Non-Habitual Resident (NHR) Portugal program has nothing to do with residency visas, it is a tax regime that offers foreign residents and investors reduced tax rates and exemptions on some taxes.