The function of suits is to flatter the imperfect human body, by adding structure and bulk in places like the shoulder, to slim the waist, and basically make the typical male look like a V. The necktie adds visual interest, basically an arrow pointing to your face and not the rest of your body. The wig hides an obvious indicator of aging. Hats were very useful when people spent a lot more time outside.
I don't know of many who think shoes aren't functional, other than the most diehard barefoot advocates.
You can think that appearance isn't functional, but tons of studies show that people do judge each other on appearances. Projecting status is the function of clothes, suits just occupy a rung above what is currently popular and what people usually want to project. People wear jeans all the time even though they don't work in the trades.