There are no rules for weapons sticking in the target after attacks
As cool as this concept is, there is no rule for it under RAW so it lies firmly under the realm of DM fiat.
Previous editions had rules for whether or not ammunition (such as arrows) broke on impact based on a variety of factors. In 5th edition we only have this quote from the PHB weapon rules on ammunition:
At the end of the battle, you can recover half your expended ammunition by taking a minute to search the battlefield.
From this we can assume that the ammunition remains on the battlefield but there is no advice given to it sticking in an enemy. There is a similar question on reusing arrow stuck in my character and the answer was that there is no rules for it.
How would I rule it?
With all that said how would I rule it if a player tried this at the table? Under rule of cool I think this should probably work. But if it works then there are appropriate drawbacks as well.
If arrows burn during a fireball they are also destroyed and cannot be recovered at the end of the fight. If you can recover a dagger with mage hand, your enemy can also hurl it back at you. This is a ruling that either applies all the time or not at all.
I have always played that weapons and ammunition are just objects and continue to exist after the attack so can be interacted with during combat. Whether they are stuck in a target or on the floor comes down to how the attack was narrated and sometimes how good the attack roll was. It has never caused any issues to rule it this way at my table.