Real question, why is Sony still making ps4s and ps4 games?
Presumably for the same reasons as why the PS2 was in production until 2013.
( 7-ish years after the (at the time very expensive) PS3 launched in 2006 and in the same year as the PS4 launch)
Money! 
More specifically, its about Sony having something to sell to
poor countries (and poor people in rich countries) without price-dumping their new and still expensive current/next gen stuff.
In many shitholes, a 500USD console is worth more than one or even
several average monthly wages and thus becomes a legit luxury item, even if there are no lunatic brazil level taxes on this stuff.
Last-gen consoles can still provide a ton of entertainment, and if you live in Afghanistan (or are the kid of long-term poor parents in the west) then chances are,
just about anything semi-modern is a major upgrade as many of these people are just about an entire console generation
or more behind the cutting edge of
reasonably wealthy 1st world gamers.
All of this is also doubly true if its a proper 3rd world country and unlimited internet is either extremely expensive or outright nonexistent,
because that just nukes any hopes of current day PC gaming outside of a net-cafe, even if you could get your hands on some cheapo ancient office PC.
It also probably costs Sony considerably less to just keep those factories running a few years past the next gen launch date than trying to make an entirely new budget 3rd world "HaramStation5" console just for these markets. And so long as they can sell them to someone somewhere for any profit its kinda an "everybody wins" situation.
Also, buying any of these modern consoles after the next one launched is the only way to get a semi-acceptable library of games to choose from.