But there is an explanation that does try and get at it a bit more analytically and that's in the paper I linked to. With the above caveats about the cultural momentum, the 12 not equal tempered scale provides a happy compromise between the number of notes to provide a basic building block for music (characters or digits would be an analogy to notes in an octave) vs the number of "good" note pair combinations (where "good" is if the frequencies have a small/simple fraction approximation).
Some of it is hand-waivey, to be sure, but at least it provides a potential reason and a starting point.
https://en.wikipedia.org/wiki/Pentatonic_scale#Use_of_pentat...
As far as I can tell, 12 ET is the smallest equal temperament that acceptably encodes the common variants of pentatonic scale. Meanwhile, the pentatonic scale probably appears because (3/2)^5 ≈ 8.
Is there an actual reason or are all of these post-hoc explanations? Depending on the culture you'll have different scales and ways of organizing the sound. From what I understand it always comes down to "some people thought it sounded good and from there they made music and people got used to it and it snowballed".