That is a very naive way of reading international relationships. Obviously the S-400 was a welcomed excuse to punish Erdogan for his destructive behavior in regards of the Turkish Justice system, Freedom of expression and other external disagreements.
Luckily for Erdogan is the F-35 only for the US and camp follower nations a very great system (for Israel as well)
But I doubt he thought that through and it was more a panic reaction to get the S-400, in my opinion.
Again, I think we are seeing a little shift in the US stance regarding F-35 and S-400. Also the time has changed and nobody cares anymore for independent Justice systems and such.