No, the Mega Pokemon will have the typing that it should be having just like in a situation where it was not hit with such moves.
If for example Charizard is hit with Soak, then mega evolves into Charizard X, Charizard X will have the typing Fire/Dragon.
Similarly, a Lucario hit with Forest's Curse will have the Fighting/Steel typing after mega evolving.
You can see a test video if you download the following video picturing how Pinsir didn't have its ghost typing after being hit with Trick-or-Treat then mega evolving (hopefully, the video will remain online for a while):
(Shadow Sneak from Pumpkaboo has normal damage on Mega Pinsir instead of Super Effective)
And this one is with Lucario:
(Shadow Ball from Pumpkaboo has normal damage on Mega Lucario instead of Super Effective)
Sorry if the Pokemon and trainer names are in Japanese!