Bear with me here as I am not a mechanic, just a dumb nurse, but your story sounds very similar to what my buddy went through last year with his 2020 laramie. I am going to type this as I remember, but I would have to reach out to him to maybe refine the details exactly. Anyways...
My buddy just had this issue last year in his 2020. He thought it was a bearing going bad... nope. So then he took it to a shop and found teeth were not looking so good in his transfer case, apparently it was missing teeth (again, going off memory) but he had his transfer case rebuilt. I'd have that looked at real good. Not my truck, I can certainly reach out and make sure thats what he had fixed, but if I remember right, that was the first gremlin that popped up.
Now shortly after that fix, he would be towing and all of a sudden the truck was stuck in 4th gear. Throw a CEL and he would pull over, turn truck off and it cleared itself. Did it for awhile and couldn't quite figure out what was going as the CEL would fix itself, but couldnt necessarily drive without pulling over and resetting it because transmission was stuck in 4th gear. Finally he noticed if the truck was going down hill, coasting, the issue would come up. Ended up being a bad shifting sensor (or something like that) but the issue is the sensor is inside the transmission and requires being pulled out. He had 95k mi on the truck. He got a brand new transmission through warranty. How he worked out a brand new transmission with the dealer... I HAVE NO IDEA!!! But he buys a few trucks through this dealership, so I am sure it helped him.
It helps that he has his own RAM mechanics through his work, so the dealer was really cool and just gave him a transmission, wrote it off on warranty and let his mechanics install it. He is partial owner of a major plumbing company here and they run all ram trucks in their fleet and have their own hired ram mechanics. So he is fortunate with that.