The important thing to remember about evolution is that nothing is moving along any sort of master plan. Evolutions just sort of steps in and tweaks stuff until it’s good enough for survival. Then it tells the critter “go eat something and have sex”.
Many evolved features make more sense when you keep this mind.