I’m not sure how and why, but this fixes the problem. It is sufficient to hit the Update button either using Edit or Quick Edit on each post and page. After that, the Like button loads correctly.
I should also mention that all posts with the problem were imported from WordPress.com.