Genes from different organisms can result through various mechanisms, for example, from virus activity. Although plants can cross-pollinate if the pollen is from a close enough species.
It is not unusual for genes to transfer laterally between species. Plants are especially easy to genetically modify because (unlike animals) they can tolerate a lot of mutations and modifications without adversely affecting viability. Some plants are so heavily modified genetically (using old school techniques, even) that they cannot survive without human intervention. Naval oranges and the common Cavendish banana are two examples; these fruits must be propagated through cuttings.
It's not the same as what you explained, but I thought of this beauty that came up by chance with some seeds (I don't remember what, Canterbury Bells I think) that failed to germinate from winter sowing in a cut off gallon milk jug. It had lodged in a crack by the wall of the jug and soil.
This was September, and all poppies had long since quit blooming. When I saw the drooping bud, I knew I had a poppy and set it in the sun to see if it would bloom. It did in a day or two.
In excited anticipation, I was looking forward to it self pollinating and producing seed, and shared it on a garden forum. Was disappointed to learn that poppies, this type at least, don't self-pollinate, forget what the word for it is. So I was crushed, have never seen any red poppies quite like this, but there must be some somewhere.
A plant scientist might have gotten it to grow by some other means, but I had to enjoy the beauty of it while it lasted and let it go. So sad when I remember that. There are cloners you can buy, I didn't have one and doubt that would have worked but people talked about how they got certain plants to propagate in cloners.
If I could live my life over again, I'd like to work more with plants but not particularly in a commercial greenhouse or nursery but on my own projects somehow self-funded. I think I would do it the way Mendel did plus cloning and cuttings but I don't think I'd want to tamper with genetic manipulation.