Pretty straightforward.
Light, fire and soul fire (latter two via #fire) are included in #dragon_transparent, a tag making blocks immune to the dragon, yet able to be flown through. Unintuitively, the #dragon_transparent tag is not in #dragon_immune, which prevents ender dragons from breaking blocks. As such, using #dragon_immune to find blocks the ender dragon cannot destroy falsely doesn't succeed for light and #fire. This is an issue for commands and data packs.
Suggested fix:
Include #dragon_transparent as an entry in #dragon_immune
Additionally, make #dragon_immune solely responsible for blocks not being destroyed, rather than both tags.
Still in 1.21.4.