Non-Markovian persistence and nonequilibrium critical dynamics