They did not, Microsoft made the bet that there would be some application in the future that would require distribution to all developers. Turns out that application was Github Copilot.
Some application in the future, that turns out to be AI? That is some level of hammering a square into a circle as I see it (confirmation bias?).
This quickly falls apart, since GitHub Copilot is also available as an extension on intelliJ, and is not exclusive to VsCode.
Vscode shines with or without GitHub Copilot, because it also has some other exclusive extension ecosystem that are not opensource but very much a bait to pull Linux devs into windows, their bet on WSL, and exclusive extensions like WSL integration and remote containers extension, literally shows how much they want developers to be in their ecosystem.
Vscode is their, bet itself to keep developers wrapped in their tentacles, OTOH Copilot is barely a feature, that allows them to charge subscribers, on multiple IDEs. Copilot is not an exclusive feature that brings devs into their ecosystem, it's just an addition.
I mean they already have published many plugins linked to azure and other services they offer it's not about copilot but they did strike gold with copilot.