I think it's a chance thing, I'm not too sure myself, but I've beaten a lot of boss mega evolved pokemon and not received a single keystone fragment yet
Have you checked in your inventory to the left of your Pokémon slots, click on the little arrow that'd slide out 4 options, then the 2nd one from the top? Could be there, it's a visual item.