Why did my LGA-ORD flight make an S-shaped turn round the time it was passing a storm? On a recent United UA1709 flight into Chicago (hit by a heavy storm at the time), I felt a noticeable descent, combined with two wide banks around 1 hour before landing. Looking at the flight path, I see an S shape that deviates from the original flight path. 

Looking at the altitude readings here, the plane registered a descent of around 3000 fpm around the time of the turns from a cruising height of 30000 ft to 21000 ft. This descent took the plane under cloud cover and into the storm, so I am certainly confused as what motivated this flight path. Given that the flight was an hour away from landing, I find it hard to believe that this was a holding pattern of some sort.

Some more things that I noticed during this flight (not sure if relevant) was that a few minutes after this, I noticed lights indicating a plane flying directly above (hard to estimate distance given bad visibility). Furthermore, in-flight WiFi briefly cut out for a few minutes.       

Can anyone explain what happened here?
I find it hard to believe that this was a holding pattern of some sort.


Believe it. An hour before landing would be about the point at which the aircraft will start its descent to its destination. Almost certainly, air traffic control were delaying your flight for a few moments to ease insertion into the landing pattern at Chicago. Doing this at altitude burns less fuel than waiting until the aircraft is lower down.

The storms were incidental. Had the pilots been avoiding the weather they'd have diverted north or south and then resumed their route. A large S-bend wouldn't be necessary.