postmarketOS does not "rewrite everything from scratch" luckily, the project wouldn't be anywhere near where it is today.
A lot of tools and daemons abd patches have been made, but also a lot of things are re-used. :)
(Just to clarify, perhaps the wording was just off?)