generate_text_for_storage() takes unparsed text and overwrites it with a parsed text. The comparison would stay the same but it would have to overwrite $text with "<pt></pt>". As it is, generate_text_for_storage() is oblivious to the format used by the text formatter and you could substitute s9e\TextFormatter with another library just by changing services.yml. If you hardcode the value, you lose that property.