I dunno, it make sense to me.
When Sam and Max screwed up the timeline by stealing their future selves' time machine, they pretty much were left to have their own adventures. We don't know the details of what happened, other than the ones Max gave us (Sam becoming an electromagnetic monster and being killed in some delightful, terrible way)
You can think of it as the ending of their own personal Season 3 we never got to see.
Personally, I like the idea that Sam wound up becoming the monster in the timestream where the duo had a time machine, since it implies they unintentionally screwed with events that would have set The Devil's Playhouse in motion and wound up causing....whatever happened.
As for Max knowing he was meant to replace his friend, you're giving him too much credit. This is Max we're talking about. He was probably aimlessly jumping around until he found Sam, without any sort of forethought about things like his doppleganger.
I assume he would have just tried to kill him and take his place.
(Sorta) fortunately, he happened upon Sam experiencing a similar partner-loss situation.
The more you think about it, the more perfectly Sam & Max the whole ending is. They enjoy the hell out of what they do, and completely disregard anything besides their main goal.
The pair altered the beginning of the universe, just to get a chicken. They even have their own wing of hell, for chrissakes.
So that whole elevator thing was a fun change of pace: to only see the consequence of that kind of universe-altering side effect, rather than the act itself. Not that they care. For anybody else, this friend-from-a-different-timestream thing would have been a problem, but Sam & Max would just shrug it off.
It doesn't matter whether it's the "real" partner, just that they got their friend back.