I think that attacking Stalingrad was almost a military necessity. It would have been extremely dangerous to leave a military center to your rear as you advance deep into the Caucuses. OTOH, if you could take Stalingrad you could hold it with far fewer troops than it would take to cordon the area, like a seige.
I think they could have put more resources into the mission after it changed to attacking Stalingrad. But they didn’t.
Cut off places with no logistical support can be bypassed and starved. Stalingrad was unnecessary militarily, at least the city fighting.
But thank goodness Hitler was drawn into it. All the Nazis killed there werent available to be turned against our boys later. For some real fun, look at a map of the USSR with hitlers high water mark on it. He barely made it into the county, didnt pass the Urals. It was hopeless.
I personally thing the Germans started believing their own BS and thought they simply were invincible.