The FAQ for Hermit specifically addresses this interaction, and yet it's still not clear to me from the wording.
Back when Hermit was previewed, people were talking about the neat combo with Scheme... that is, you could choose to top-deck Hermit with Scheme, and then when you go to discard Hermit, Scheme would top-deck it, which would prevent Hermit from being trashed, but you would still get the Madman.
However, the FAQ for Hermit seems to imply otherwise... it says that if you choose to top-deck Hermit with the Scheme, then the "discard from play" clause won't fire. But it's not clear if it's just saying that it won't get trashed (allowing the combo), or that it won't work at all; no Madman for you.
The way I read the cards... you would discard Hermit from play. At that moment, Scheme and Hermit would both trigger their on-discard. So you would choose the order to resolve them in. You choose Scheme first, top-decking Hermit. Then you resolve Hermit, trying to trash it but failing because of lose-track, and gaining a Madman.