You got it all wrong.
It was developed for Macs first because Microsoft is in the business of selling software and Windows wasn't such a big thing back then, in fact it barely existed as Windows, it was mostly MS-DOS still.
Microsoft definitely didn't buy something they created themselves.
Oh. I got the Mac part right but not who made it. It looks like I was conflating it with PowerPoint, which was Mac first and made by a 3rd party MS bought.
PowerPoint appearing first on Macs is not surprising because historically Macs have been focused on DTP applications, and were much more powerful for that (still true this day).
It took quite a while for Windows to be comparatively capable, I think this is why Microsoft bought PowerPoint, to make up for it.
Hilariously today PowerPoint is considered to be worse than Keynote, some things never change...
Microsoft definitely didn't buy something they created themselves.
https://en.wikipedia.org/wiki/Microsoft_Excel#Early_history