NOTE: I am not 100% familiar with Minecraft commands, but I may have found a way according to the wiki.
You can use the
/testforblock command to check whether a certain block is in a certain location. This command can be run using the Tilde notation (~3, for example), to get a relative location towards the command execution. You can then prefix that with the /execute command to execute it at a player's location.
Another thing you can do is instead of using coordinates is specifying a radius using [r=R].
putting those together, you can do one of 2 things:
find a player and test if any of the common "top layer blocks" like sand, gravel, stone, dirt or grass blocks are within X blocks on the Y Axis. If the command is true, teleport the detected player upwards..
for every top block in the infinite elytra area, select all players that are within a certain range and teleport them upwards.