I started a month after the game's release, and finally reached lvl 40 during the Halloween 2017 event. Most of my XP gains were from catching Pokemon, and several events that held double XP helped me reached lvl 40 faster. Considering the massive XP you get from legendary raids (in addition to the use of lucky eggs), reaching lvl 40 nowadays doesn't feel as prestigious as it seemed back in the days during the old gym system. Despite that, I would imagine only a small percentage of the entire PoGO player base still has even managed to hit lvl 40, but unlike the good old days, many are starting to catch up, and are trailing behind the footsteps of the lvl 40 life.
Prior to reaching lvl 40, my first goal was to hit lvl 40, and finally did. Thus, XP is no longer a necessity for me, and probably isn't for every other lvl 40 player. As a fellow lvl 40 player, I now have other goals I have made for myself to reach to continue being engaged with the game. Five of them that I hope to achieve someday are:
-Catch a 100% Mewtwo (my ultimate goal, it's my favorite Pokemon)
-Collect and fully max out one of every Pokemon to lvl 40 (maybe even try to get each of them with 100% IVs, too)
-Reach over 100k total catches
-Find and catch a 100% shiny Magikarp
-Get over 10k battle victories for my Dragonite and Lugia
As long as I continue to set goals for myself, I still enjoy the game. I will probably continue to play this game until Gen 4. Any generation of Pokemon beyond Gen 4 is uncharted territory for me, but perhaps I'm thinking too far ahead haha. Who knows what this game will be like when Gen 4 (or other future gens) is potentially released in the game. Hopefully, I'll be as interested in the game by then as I am right now! :]