According to this question about Tangled, Rapunzel couldn't get her hair back. Then why is she shown with long hair in Ralph Breaks the Internet?
In the Tangled TV series, Rapunzel gets her hair back:
Since the movie also contains a reference to Cassandra from the show, it would appear that the movie takes place including TV canon.
This reference, by the way, is a painting of an owl on the wall during the princesses scene that looks quite similar to Cassandra's owl from the TV series.
(Hat tip to Flicks and the City, at around 4:40.)
Also, of course, because she wouldn't be recognizable without her distinctive hair.