Without knowing the algorithm being used, it would be difficult to know why it chose that route. Not sure if the priority it sets is to minimize overall altitude change, minimize number of steep grades, or something else.
In the route you mentioned it looks like the maximum downhill grade is about 4% going both ways (direct and through Detroit). My first thought was that the distance would be longer going through Detroit, but it's almost exactly the same going both ways. It does look like the route through Detroit would eliminate lots of the up & downs.
Not sure why it chose one over the other, other than possibly factoring traffic or some other road condition. However, when you run the route directly through Google Maps, it chooses the route via Detroit.