OP's query:
My question is: does past perfect work the same way but in the past?
I had been doing working /had worked there for 2 years on Monday.
Please note that in this instance, the Past Perfect Continuous is inappropriate as it works better when the completion point is an event rather than a set day or date. Some grammar text books may use Past Perfect in this way.
You don't need to use these tenses if you can convey the same idea in the Simple Past tense.
On Monday, I completed my second year of employment there.
Past perfect tense and Past Perfect Continuous tense can be used in the following manner(both have same meaning):
My aunt had been living in London for fifteen years when she died.
My aunt had lived in London for fifteen years when she died.