I've created exactly the tool you described: https://github.com/jhasse/minclude
It removes the includes in random order though. Also the downside that are mentioned in other answers are valid: It will remove a lot more than what is "used".