I have a personal perspective and an objective perspective. Personally I own a lot more PS3 third party games than PS4 third party games. That doesn't even include the many PS3 games I tried and then traded back to Gamestop. With PS4, I've bought few and traded few. There just aren't many games to interest me.
Objectively, there have been a lot of mid-tier third party studios that have gone under in the past 10-15 years. In other words, there was a decline in third party output going from both Gen 6 to Gen 7 and Gen 7 to Gen 8. PS2 and PS4 are both very successful consoles. Wikipedia says "over 3800" for PS2 while a google search gives 1600 physical titles for PS4 as of July 2019. I seriously doubt PS4 is going to double it's number of titles from July 2019 til the end of it's life. PS2 will have a lot more physical games in the end.
The cost of graphical fidelity goes up every generation. We lost a bunch of mid tier developers as a result. In fact this is a common business strategy in just about every industry. The established players make it hard for smaller and new businesses to compete. In this case the AAA third party publishers make the cost to compete very high, especially when it comes to graphics. Mid-tier players go out of business as a result.
Now, if we are going to include downloadable-only titles, then PS4 actually has a lot more games than PS2. But if you are in the same camp as me, then you really appreciated those mid-budget games. They provide variety and uniqueness to consoles, while still have decent graphics and scope. Take away the mid-budget games and all of gaming feels a lot more samey.