Note: After some looking into this is actually a duplicate of [MC-197616 Certain custom biome settings cause game to spam "Received invalid biome id: -1" in the console, causing major lag or freeze|https://bugs.mojang.com/projects/MC/issues/MC-197616?filter=allopenissues]. It's just that it's indirectly, as both are about the same issue of world generation through datapacks.
Oh my, I thought this was just me! I created a bug report for nothing it seems. +1 though! This really does need to be fixed!
Note: it seems that it is most notable at spawn chunks. The lag seems to be a lot better once you go further from spawn, but it's still there as far as I know.