The logic was added in commit ec8306835d, to show the like action even if the user could not like the post. It is not necessary for this logic to be implemented on the server side.
ec8306835d