Might be a duplicate or caused by something else. Dragon seemed to spawn at end gateway, and took some (suffocation?) damage.
Was not on a Realm or server, just a regular world.
Video and screenshot are in attachments.
May be a variant of a Realms bug that is showcased in this video from 2019: https://www.youtube.com/watch?v=tyGL3GXq8Ew