The byte stream is one of the first components that was written. Probably It wouldn't be written nowadays. The browser is quite modular, so in the end you can completely out out of that system.
Layout is much harder because the CSS spec is full of UB, so you will have to do some reverse engineering there.