There are already written programs like that, like Resource Hacker to extract resources from executables.
If you want to write your own is not that hard, windows has many APIs to work with.
A manifest file is just an XML formatted file which can be stored in executable as resource or in a separate file with ".manifest" extension in the same folder as executable.
Windows loader reads this file at runtime and take the necessary actions.