i think its more of Lichita's power in sealing things without magic that Liebe was in the grimoire. So as Liebe says Asta was Lichita's son, it probably happened just few years before Asta was born. So the event with the demon and Licht turning his grimoire to 5 leaves has nothing to do with Liebe being sealed inside the grimoire.
It was just probably lost somewhere waiting to be found or waiting for its next owner. Lichita said she just found it, she did not actually acquired it in the tower where gremoires are being placed. And i think it is not in the tower either together with the other grimoires (coz asta did not received it inside the tower but when he's already outside) because it has a demon's power on it.

Oh lord for a second there I thought that liebe was asta's anti-magic-demon daddy nd maybe that's why he couldn't use magic either nd why 5 leaf grimoire chose him. Oh which reminds me, I realllyyyy wanna know the whole "5 leaf grimoire and devil resides in it" deal because since now we know that liebe was the demon there, but the grimoire was made 5 centuries ago right?!! By the demon that corrupted licht, so shouldn't that demon have been in the grimoire before liebe or is he there in the grimoire along with liebe nd they just don't know it?! Or is it like the 5th leaf gives the grimoire the 'ability' to host a demon nd not exactly comes with a demon pre-installed??