Of the half dozen films that Thor has appeared in over the years, Age of Ultron was the one that truly felt as though it had no clue what to do with the character. It's no secret that much of Thor's personal journey in the film surrounding his trip to the Norns was cut from the movie, resulting in the much-maligned, all-too-brief cave sequence we got.
To be fair, it set Thor down the road that led to Ragnarok and Infinity War, but in the context of the film, the scene's brevity is symbolic of Thor's role in the film overall. Unlike the first film, which carried some emotional weight for him due to the presence of Loki, Thor just felt kind of there the second time around, getting some cool action moments and being the one to fully bring Vision to life but not actually getting anything thrown his way in terms of character work.
Not to mention, the opening moments of Ragnarok ended up brushing off where Age of Ultron left off for the character - with Thor headed out in search of the Infinity Stones - which has only retroactively made his appearance in the Avengers sequel feel more of an obligation than a necessity. That said, we did get the great party scene in which his friends attempted to lift Mjolnir, with Thor worriedly noticing that Cap actually did move it, so it's not a complete loss for the character.