The package [highlight-refontificaion][1] visualizes how font-lock refontifies a buffer. In this case, it starts at the line where the point is.

One way to handle this is to add a function to `font-lock-extend-region-functions` to expand the region to include the full heredoc comment.

One thing that is curious is that the highlighting becomes correct when pressing `return` but not when evaluating `(insert "\n")`, something I have no explanation for.


  [1]: https://github.com/Lindydancer/highlight-refontification