I remember jumping to the conclusion that Alan was in the process of leaving the show as far back as 2004 - between his dwindling appearances on the show, and the fact they did a whole episode where Natalie Portman was filling in for him while he leaves for vacation, it felt like they were looking into replacing him. It's a common practice for TV shows: if they know a castmember will be leaving, they'll start experimenting with replacement characters; like when Don Knotts was leaving THE ANDY GRIFFITH SHOW, they did episodes where Andy would have a temporary deputy, like Jerry Van Dyke, to see who could fill Barney's shoes.