I think I implemented my feature request with ID: 3146291
Please, review carefully my code - to be honest I don't have really much experience with Python.
And few moments:
1) When we adding/fixing interwikis on subpage, I think we should remove interwikis in template itself if any
2) It seems that logic of determing whether this page has subpages, getting interwikis also from included subpages etc should be decoupled from interwiki.py and moved to wikipedia.py
3) Not really related but.. cosmetic_changes.py removes interwikis from subpage.
Uploaded new patch with some fixes.
Any news?
Sorry for the very... slow response. The problem is that interwiki.py is complicated (as you have noticed), and it's a somewhat complicated patch. To be honest: I'm not even sure how much interwiki.py does in terms of templates, subpages... and as such I'm scared as hell to even touch the script, considering it sort of works at the moment.
Housekeeper's note: the patch does not apply cleanly to r10035