Are we now reinventing PHP but coming from the opposite direction?
Php has no understanding of html. It streams the php file as bytes, and anywhere it detects the byte sequence that corresponds to “<?php” it starts executing code instead of streaming until it reaches “?>”. You can stream anything. You can rename a png file to .php and put some php tags in there and it will work. You need something that understands html’s structure to properly escape. Php can’t do it natively, hence the many templating libraries for php.