Thanks haha!
For me, a lot of the times (and in this case) I just think of a theory concept (in this case, the mario cadence, which to me kind of encompasses the feeling of freedom) and give it little twist (in this case, not resolving it immediately). Then I just kind of play with this idea on a piano or something till I have a more complete idea - melody, harmony, maybe lyrics - and then I just start translating it to sheet music or recording it into a DAW.
For folky tunes, I find that using modes is really helpful (espcially Lydian and Dorian, they have a very folky sound), and writing melodies that are more lyrical and easy to sing, Hope that helps lol (sorry if I rambled too much, I just really enjoy talking about the process)!