Keeping your feet clean and protecting them from surfaces are the primary purposes of shoes. Some people need them for support after having worn shoes too often (my parents are in this situation and have a separate set of "indoor shoes" just for this), or some sort of disability that needs those super-wide-sole shoes, but in general they are not for supporting your feet.
Hiking boots can significantly enhance stability and of course walking over sharp rocks becomes trivial.
I also forgot to mention steel toed boots, no slip restaurant shoes, and other injury-protective shoes.
Then you’ve got temperature: hot pavement, cold snow.