I suffered from insomnia as a child and it peaked when I hit 12-14 yo. My pediatrician told me to do EXACTLY as you suggest, namely "If you’re in bed for more than 20 minutes and haven’t fallen asleep yet, get out and do something else.". Basically, don't use your bed as the place to TRY to sleep. Only sleep there. This worked like a charm for me and I haven't had sleep issues since.