Now my question is: how future proof is this solution, especially because I assume that the index must be at least one bigger than the methodCount()?
It should work as of now.
As for future proof... may be. The snippet is using unsupported features which means those might break at any point in the future. It is likely though it will continue working.