The first example is not quite right. We can use was when we are talking about John's state at a point in time:
Ten months ago (we are thinking about a particular point in time) John was living in London.
Ten months ago John was single.
Ten months ago John was a chef.
Ten months ago John was unemployed.
Note that in the last example we talk about his being unemployed at that point in time.
When we talk about a condition that lasts for an extended period we need to position that activity relative to the point in time. We use had been to indicate that the activity completed at the point in time under consideration.
Ten months ago John had been working as a chef for 3 months.
Ten months ago John had been unemployed for 7 months.
In these cases there is a very strong implication that something changed at the point in time.
Ten months ago John had been unemployed for 7 months. However, he found a position at XXX and has been working full-time since then.