Datapack was working for overworld mobs, but magma cubes seem to still do damage in the latest release of 1.18. Thank you Scommander!