Since Marvel Studios did not have access to their trinity of big franchises — Spider-Man (owned by Sony), Fantastic Four (owned by Fox), and X-Men (also owned by Fox) — but had a library of thousands of characters to adapt, they had to get creative when starting up a project as ambitious as the Marvel Cinematic Universe, which practically necessitated their need to get creative with building the setting. As such, they started with setting up a slate to adapt The Avengers and went in wild directions from there.
Even after February 2015 saw Sony share the Spider-Man rights, and March 2019 saw the Fantastic Four and X-Men rights fully revert to Marvel Studios, it didn't spell the end of Marvel looking through their libraries of characters to adapt to the big screen. If the slate for works released after The Infinity Saga is of any indication, then Marvel's commitment to find their most unexpected picks to appear in the setting is not going to stop anytime soon.
Be wary, all spoilers will be unmarked. You Have Been Warned!
General
- The most macro example: X-Men, Deadpool and Fantastic Four joining the MCU. Beforehand, it was thought impossible as their film rights were in the hands of 20th Century Fox, a massive conglomerate that had no intention of ever giving up the rights. So Disney's solution was to simply buy Fox for $71.3 billion, even though the Fox-Marvel rights were nowhere near the main reason that Disney bought the company, and were just a small bonus.