Guardians do not take damage from magma blocks when sucked down by bubbles. I do not know if this is intended or not, but I'm hoping that this is a bug and will receive a fix eventually.
Edit: They do not take damage from magma blocks on any side of them.
Duplicate of MC-102267.