I have had this theory for a while - basic principles in math were likely known by early humans such as caveman (and possibly some level of understanding might even be possessed by animals). I think this is because these basic math principles are "useful" at describing the natural world. In short (I believe that), completely different lifeforms that live on completely different planets, yet provided these planets share similar laws of physics - these lifeforms will likely encounter and develop similar principles in mathematics.
For example, consider the triangle inequality:
$$\|x+y|^2 \leq \|x\|^2 + \|y\|^2$$
Thousands of years before mathematicians like Euclid, I think it's possible that caveman might have had some knowledge and encountered some version of the of the triangle inequality, as it likely came up in daily tasks involving hunting and navigation. As this inequality likely proved to be both accurate and useful in describing relationships between sets of distances, it likely survived from generation to generation and became engrained in the collective mathematical knowledge of societies. On the other hand, relationships that were not accurate and useful did not survive and became forgotten. While the debate on questions such as "was mathematics discovered or invented?" might never be solved - I think this might be the closest we can get: mathematical ideas that proved to be useful and accurate have higher likelihoods of surviving over time.
This brings me to the next part of my theory - why is the triangle inequality true? Does this have anything to do with the geometry/manifold of planet earth? Are there some geometrical surfaces (e.g. highly irregular, curved, non-smooth, discontinuous and bumpy surfaces) in which the triangle inequality is true?
As an aside, consider the following idea: Researchers from the domains of linguistics and biology believe that vastly different cultures that live in similar environmental climates have similar language patterns. For example, different cultures in humid climates have been observed to use fewer consonants - as consonants require more energy and stress on the larynx, and humans naturally try to conserve energy in more humid climates (e.g. https://www.frontiersin.org/articles/10.3389/fpsyg.2017.01285/full, https://academic.oup.com/pnasnexus/article/2/12/pgad384/7457938?login=false, https://academic.oup.com/jole/article/1/1/33/2281884?login=false, https://www.pnas.org/doi/abs/10.1073/pnas.1417413112).
Given this idea, I believe the following premise:
Just as different cultures in similar climates eventually stumbled upon similar language patterns ... (I believe that) in any planet where the geometry of the planet allows for the triangle inequality to be true - lifeforms on that planet will eventually encounter and conceive of the triangle inequality.
In a more general sense, planets that share similar laws of physics and chemical compositions will undoubtedly will share some forms of physical commonalities (e.g. behavior of fluids such as evaporation, melting of solid objects, etc.).
Lifeforms on these planets will observe similar natural phenomena and try to create mathematical, logical, scientific paradigms/models to describe these natural processes (e.g. mathematical relationships between volumes of liquids, their boiling temperature, pressure and altitude i.e. https://en.wikipedia.org/wiki/Triple_point, https://en.wikipedia.org/wiki/Clausius%E2%80%93Clapeyron_relation) in their environment - and these logical/scientific models from different lifeforms will likely be similar to one another conditional on the fact that their environments are similar.
Thus, these lifeforms will inevitably stumble upon and encounter the same math principles due to the properties and constraints of their physical environments.
So going back to my original question: Are there some geometrical surfaces (e.g. highly irregular, curved, non-smooth, discontinuous and bumpy surfaces) in which the triangle inequality is true? I conjure that lifeforms on such planets will discover and use different geometrical identities to describe relationships between sets of distances that are more accurate and useful on their planets.