I have understood the issue about damage_type, it is an experimental features so not supported by realms. But the other functions that were deleted by mistake, in fact I have renamed the folder according to the format of the 1.21 update (e.g. functions changed to function), but they were still deleted as useless files. I think it's the useless file deletion mechanism of realms that has not been updated in time.
@turbo Sure, I've uploaded my datapack.
Now that datapack is uploaded.
After updating realm to 1.21 Pre-4, more files in datapack were deleted by mistake.
This problem also exists in Snapshot.
I retried and now the function doesn't get deleted anymore. Thank you, now all I can do is wait for Mojang to remove damage_type from experimental features.