I have the same exact issue. I trade in my 2016 duramax specifically for the 10-speed transmission and the auto trac transfer case. Got the truck in March, 2021 with 13 miles on it. It has 14K on it now. Happened the first time last month. Was hauling a 19K load on a bumper pull trailer through shitty road conditions. I would say I went about 40 miles, turned onto a unplowed street, and bam, Service 4WD and the "auto" indicator on the right side of cluster changed to orange. Still said it was in "auto" but no power to front wheels. I had to have a 2020 Dually without auto t-case come pull me out.
Took it to a dealer, not selling dealer, and was told it was a can bus error because I have a Edge CTS3 monitor plugged into OBD port. Also, by the time I took it to them later in the day it had already reset and was working again.
Fast forward to last weekend we had another snow storm, driving in auto again, about 20 miles in, boom same message and back in 2WD even though truck said AWD.
Called selling dealer whom is taking it tomorrow and giving me a loaner. I've read all sorts of things they dealers try and none seem to fix it. What a mess!
I have found that if you turn the truck off and while starting it push the drive mode you want, it will shift. So in my case this past time I shut it off and immediatly restarted it while pushing 4HI. It started up and switched to 4HI and even though it was still lit up yellow and said service I actually had 4WD.