How was this decided, and when else could it happen?
As noted in the Guardian article you've linked to, UEFA's "control, ethics and disciplinary body" decided that the last 18 seconds must be replayed. As noted in the same article, FIFA ordered that an entire match be replayed in 2005 after a referee made exactly the same error.
Was it special that it was a misunderstanding of the rules rather than a simple refereeing mistake, like not seeing the ball crossed the line?
Yes. A referee making a mistake on a judgement call is (as far as I know) irreversible. The difference here is that the referee didn't know the laws of the game fully and made a decision, when she had time to spare and think about the decision, that directly contradicted the laws.
Would it be possible to replay a more significant part of the match (e.g the last 20 minutes)?
That's a question for the regulations of any particular tournament / organising body - but in general,...