You're along the right path with /time query daytime
.
First of all, create an objective. In these examples I'll use "TimeObjective" although you can call it whatever you want:
/scoreboard objectives add TimeObjective dummy
Next, put /time query daytime
into a command block. Then stand ontop of the command block and type this. Again, "TimePlayer" is just a fake player name, it can be anything so long as it's consistent:
/stats block ~ ~-1 ~ set QueryResult TimePlayer TimeObjective
Now, whenever the command block is activated, the current time will be stored in TimePlayer's TimeObjective score. Set that block on a clock. To test the score of a player that doesn't actually exist, you need to use this command rather than /testfor:
/scoreboard players test <PLAYER> <OBJECTIVE> <MIN> <MAX>
So for this case:
/scoreboard players test TimePlayer TimeObjective 0 1000
As you said "natural selection of other blocks", you will not get any blocks. There is a complex formula that tells the game what blocks may spawn at what location, which includes depth.
In other words: It's not possible to get a natural selection of other blocks to replace the stone.
The custom generator for Minecraft allows you to generate worlds without stone, but you will have to define the exact layout of the world, which is not generated as you want it to be.
Last resort: A custom mod. Downsides to this are that you most likely cannot update your game and world if the game gets an update, without losing most of the new features, or without losing the functionality of the mod. Also, if you want to play with friends, you will need to host a server, which requires a lot more RAM compared to just sharing your world through the game client.
Best Answer
This is not possible with the methods of Vanilla or the Lucky blocks mod. Either you need another mod for that or you can run around and replace stone, dirt etc. with lucky blocks using
/fill
.