The legend she represents is the only reason I can accept her as the final villain, that and she is a precursor to the Boruto manga. She is a poor "Final villain", but honestly, she ISNT the final villain, because the story continues on after her.
So much of naruto takes direct inspiration from japanese mythology, in could be argued that if you were japanese, you probably EXPECTED her to appear in the end. She probably does not feel "unforeshadowed" or anything to them.
All that being said, Im american. So I'm not exactly satisfied with her. But I can at least understand her appearance... and I guess it isn't exactly bad writing, but I don't think its great writing either.