Check the hanger, might be a bit twisted too. As you come down onto the small sprockets the derailleur pivots backwards and the cage forwards which exacerbates the problem because the jockey wheel moves inwards relative to where it should be. So you get the indexing OK on the large sprockets and have problems on the smallest, or vice versa...
Look at the vertical axis through the two jockey wheels and cage from the back of the bike, it should be parallel to the sprockets. Turn the bike upside down and looking down from above check that the jockey wheels are running parallel to the sprockets. If not take the derailleur off and tweak the hanger with a shifting spanner...gently...
And no, that chain isn't that dirty...