Why did Tanaka get the earned run and loss against the A's on 26 May 2017, when the runner he allowed in the eighth got thrown out at the plate and didn't score?
9.16(g) is probably the most relevant rule from the Official Baseball Rules that applies here.
(g) When pitchers are changed during an inning, the official scorer shall not charge the relief pitcher with any run (earned or unearned) scored by a runner who was on base at the time such relief pitcher entered the game, nor for runs scored by any runner who reaches base on a fielder’s choice that puts out a runner left on base by any preceding pitcher.
Phillip Kendall's comment about this being a fielder's choice situation is correct.
Batter 2 (Rosales) reaches on a single, so is Tanaka's run on base.
After the pitching change, batter 3 (Davis) reaches on a fielder's choice. The ruling is basically that without Tanaka's runner (Rosales) on base, Davis would have been out and no runners on. So Davis continues to be charged as Tanaka's baserunner under 9.16(g).
Batter 4 (Joyce) walks and is credited to Clippard.
Batter 5 (Lowrie) singles. This drives in Davis. The earned run is credited to Tanaka. As this run put Houston in the lead, Tanaka is then on the hook for the loss until the game becomes tied or the Yankees retake the lead (which did not happen).