I’d guess they knew there was at least the potential for something like this, since both characters have larger histories in the comics. And I recall Sebastian Stan signing a contract for like nine movies after The Winter Soldier came out, which seemed excessive at the time but makes a lot more sense now.