At the end of SAO, Kayaba mentions that SAO was deleting itself. However, when Kirito joins ALO, Yui tells him it was all copied from SAO.
How was SAO copied for ALO when Kayaba said it was all being deleted after SAO was cleared?
Because ALO was created before SAO was cleared.
Argus created SAO but after Kayaba started the Death Game the families of victims of the game sued the company which bankrupted them and forced them to sell the Cardinal System to RECT Progress Inc
When Kayaba Akihiko effectively trapped 10,000 players in the game, many of the deceased players' family members sued the company. Argus then filed bankruptcy, selling their rights to the Cardinal System to RECT Progress Inc., which used it to create ALfheim Online.
Source: Argus > Chronology > Aincrad Arc
Cardinal is the backbone of SAO and a portable version was in the World Seed which is why in the Seed Nexus one can easily convert their accounts between games. however ALO is different because the Wiki suggests that, aside from SAO, ALO is the only other VRMMO with a highly advanced version of Cardinal, probably because the portable version is simplified for normal users while RECT Progress/Ymir are using a full copy from Argus.
Suguha also started playing ALO while Kazuto was still in a Coma because she wanted to know Kazuto better
Suguha originally disliked VRMMO games for it hid peoples' nature and reality, as it did with Kazuto. She took up ALO in order to understand Kazuto better when he was trapped in SAO.
Source: Kirigaya Suguha > Background (2nd Paragraph)
as such ALO was built and running before SAO was cleared.