Since it's an unlikeliest event, I wouldn't worry about it. As there is no telling how Sony is going to implement such a ban (stop that account from logging in to PSN, remove all items from that account's ownership, etc), so it's hard to tell whether having a game installed on the PS4 hdd will survive what Sony implements. Maybe Sony has a backdoor command that can nuke our PS4 and wipe off all games owned if an account is banned, in that case may need to unplug all network cables

.
In some cases, like those free games you get from PS+, they carry a "valid period". The installed games have an end date (set to the end date of your current PS+ subscription) and won't work thereafter, even if it's permanently installed. If you extend your PS+, the valid period gets extended, so perhaps the PS4 does periodic checks or the server side can issue a command to update all valid period on the PS4.
Fully purchased games do not have such period, but from time to time, people report that their installed games don't work and they have to re-validate the license (an option on the ps4 menu). So perhaps Sony does verify the license of each game periodically by forcing you to log on to your account, even if the game is fully purchased. This is only logical and reasonable, for example, you might have bought a game wrongly or for whatever reason you contact customer service to cancel the purchase and get a refund. If Sony agrees to refund you, then they must have a way to prevent you from playing the installed game, even if you disconnect network cables.
So having a purchased game installed and never deleting it should be permanent enough (though you are wasting HDD space) but in theory it is possible that Sony can stop you from playing it. And of cos one risk of such digital ownership is what if the company goes bankrupt? (Sony, Valve, or for that matter, DBS, UOB, OCBC...

)