As for why they preferred M4P (AAC) to MP3, it was a licensing issue. MP3 was patent encumbered until 2017. Apple, being Apple, didn't want to pay to license the encoder I believe.
> However, a patent license is required for all manufacturers or developers of AAC "end-user" codecs.[52] The terms (as disclosed to SEC) uses per-unit pricing. In the case of software, each computer running the software is to be considered a separate "unit".[53]
[…]
> The AAC patent holders include Bell Labs, Dolby, ETRI, Fraunhofer, JVC Kenwood, LG Electronics, Microsoft, NEC, NTT (and its subsidiary NTT Docomo), Panasonic, Philips, and Sony Corporation.[16][1] Based on the list of patents from the SEC terms, the last baseline AAC patent expires in 2028, and the last patent for all AAC extensions mentioned expires in 2031.[57]
* https://en.wikipedia.org/wiki/Advanced_Audio_Coding#Licensin...
Basically, AAC was cheaper for Apple so that's what they used.
But AAC was as "open" as MP3 and there was never any "lock in".
Apple was never "hostile to MP3". Even iTunes 1.0 (considered an "MP3 player" back then) supported ripping CDs to MP3, using the Fraunhofer MP3 encoder that was far superior to alternatives (especially at that time).