I was recently asked to review a paper. I liked the paper a lot and eventually recommended it for publication after minor revisions. The paper inspired me to do further research on some questions motivated by the paper. I did the research parallel to writing the report and quickly made progress (theoretical field, i.e., no experiments, etc.) I have now returned my report, and my research should be submitted/preprint-ready in 2-3 weeks.
Ethically, I think there is no problem. There is a preprint version of the paper that I refereed, so I did not use "insider knowledge" to advance my research. Also, the problems that I tackled were substantial and separate from the original paper, so there is nothing to ask the authors to add to their paper.
However, I am now pondering the timing of submitting/disseminating the preprint of my work. Should I (morally speaking) wait until the original paper is published? Until it is accepted (editor's decision still outstanding)? Also, should I submit to the same venue, or will this be met with disfavour?