do I start to qualify for a state pension from the time I started working or only from the time I get IRL or citizenship?
The UK state pension it is nothing to do with settlement (ILR) or holding British citizenship. It is based solely on those who have contributed to the UK over the years, or those who have claimed certain UK benefits for a while. i.e. Child Benefit. There is no more piggy-backing allowed for a UK state pension (being given a 60% state pension based on the contributions of a partner, or ex spouse).
If you are earning enough to pay NICs, then you are already working towards a UK state pension.

If you are working for an employer (PAYE - pay as you earn) you will be paying Type 1 NICs.
Type 1 NICs would allow you to claim Contribution Based JSA (job seeker's allowance) if you lost your job, or Contibution based ESA if you were too sick to work for a while, as long as you have contributed in the previous two relevant tax years. Contribution based benefits are not public funds and you could claim these even though you didn't have ILR. These benefits are solely for those who have been contributing to the UK and they ignore the salary of their partner or any savings they have, but are usually time limited. They are a temporary help for those who have been contributing to the UK.
The UK has 4 types of NICs, Type 1, 2, 3 and 4 but they don't all give the same things. This chart shows what they each allow.
https://www.gov.uk/national-insurance/what-national-insurance-is-forType 2 and 4 are for the self employed. but Type 2 is ending and Type 4 is changing.
https://www.gov.uk/government/consultations/consultation-on-abolishing-class-2-national-insurance-and-introducing-a-contributory-benefit-test-to-class-4-national-insurance-for-the-self-employed/the-abolition-of-class-2-national-insurance-introducing-a-benefit-test-into-class-4-national-insurance-for-the-self-employedAnd that National Insurance Number you have is called a NINo (knee-no)
