How do entry elements render a default string but also return an object at the same time?
It's the __toString() magic method:

The __toString() method allows a class to decide how it will react
when it is treated like a string.

https://www.php.net/manual/en/language.oop5.magic.php#object.tostring