Alright, here's my stab at this. It started pretty much as expected, I've ripped the part about committing the merge from the fetch extension. And I've made it configurable, so you need to set this to enable it:
But then I hit a snag concerning "hg pull --rebaseif": Since we want to do a commit in the rebaseif part, we need commit options (like user and date), which "hg pull" doesn't have. So we can't keep the interface of "hg pull --rebaseif", which simply wraps "hg pull", but need a specialized command instead, which can declare its own options. I've chosen "hg fetch", since what we're doing is like the fetch extension, only better (due to rebase).
Since I set up an alias "fetch = pull --rebaseif" first thing after installing the extension, I'm personally not too worried about breaking the former interface -- but I'm not sure what you think about this whole enterprise now. ;)
Sorry for taking so long to look at this. I haven't had time to give my hg-extensions any love. (Also, I'm not using them at work anywore)
But, well. I think your idea is sound.
I don't like the nameclash with the existing fetch-extension, since you might have both installed. (different use-cases for different repos, perhaps). I think it should be called something different (rebaseif, or better) then people can alias that instead.
Other than that, since there are no tests, I take it on faith that this works as expected?