The Bug
I switched the World Type to Debug Mode somehow, and switched to Normal, then I set its Game Mode that not the previous.
I did as in this video, and I found the Game Mode reset back to what I set that before switching to Debug Mode.
If the video doesn't work, try this then, thank you.
https://streamable.com/81x4qw
For future reference, Debug Mode is selected by holding the Shift key while clicking the world type, potentially only if world type is on "Floating Islands"(snapshot 20w21a) or "Buffet", as Debug Mode is listed after those, despite being inaccessible without holding shift.
But I was able to recreate this bug, and have a little more info.
This does not seem to be purely a visual glitch. When recreating the steps in the video, I tested it further by these means:
Pick hardcore mode
go to more options and switch to debug
go back to first screen (it may not matter, I didn't test this bit)
go to more options and switch to default
go back to first screen, and pick Creative mode
click generate world without clicking on more options again******
When doing this, the world will generate with the player in Creative mode, as was displayed on the screen directly before generating the world.
I then tested using these steps:
Pick hardcore mode
go to more options and switch to debug
go back to first screen and then back to options, or skip this step, as it may not matter
switch to default
go back to first screen, pick Creative mode
**go to more options
generate world without going back to see what gamemode it will be in
When doing this, the world will generate with the player in Hardcore mode, as was "locked" in after choosing and then switching from Default.
Basically my conclusion is that if you're looking at the screen in which you pick the gamemode, the world will generate with that gamemode, even after initiating the bug with Debug world option, and if you aren't looking at that screen but the "more options" screen, the world will generate with the gamemode that was selected before Debug was first chosen, as the bug describes. So it switches to the "locked" gamemode upon moving to "more options".