The first is correct: Nos comimos todos los pasteles que nos habían enviado;
if you want to say something you did (Nos comimos todos los pasteles) you have to use the verb in the past form (que nos habían enviado), because in the second sentence: (que nos enviaran) is something that is going to happen in the future.