A few years ago, I was looking for a new job after being laid off. I had two competing companies to choose from, and chose the one that sounded like it would be more exciting. After about five months, though, I was miserable and called the other company to see if they'd still take me; they did, and I've been happily working here since.
But after I announced my departure, a few engineers from other teams came up and told me they wished I'd let them know before quitting, since they would have been glad to have me on their team instead. They knew the reasons I was feeling frustrated, and felt confident that those issues were either not a problem on their team, or were at least being worked on. I still kind of wonder how true that was, and what would have happened if I'd made the switch internally, instead.
Anyway, that was kind of a long and boring story - two whole paragraphs! - but I think this was probably the one of the more valuable parts of OP's post. An internal team change is often a lot less stressful and less risky than going to a different company.