i hate to be that guy, but pick the right tool for the right job. use markdown for a readme and latex for a research paper. you dont need to create 'the ultimate file format' that can do both, but worse and less compatible
I agree with your assertion that there isn't a perfect format. But the example you gave - markdown vs latex has a counter example - org mode. It can be used for both purposes and a load of others. Matroska container is similarly versatile. They are examples that carefully designed formats can reach a high level of versatility, though they may never become the perfect solution.