The answer is yes, you can perform the steps you mentioned.
I'm not going to write the application for you but here are some guidelines. First, apktool is written in Java so you can download the latest release packaged from here. Make sure you read the license first. Then import it into you Android studio project. There is a specific class that is called Main with a main method that is responsible for the CLI. For example:
import brut.apktool.Main;
try {
Main.main(new String[]{"if", "/sdcard/...your_path.../framework-res.apk"});
Main.main(new String[]{"d", "myApp.apk"});
} catch (IOException | InterruptedException | BrutException e) {
e.printStackTrace();
}
PS: In case I misunderstood your question. If you want every time the program runs to download the newest version of apktool jar from Github you can use JarURLConnection to fetch the remote jar file and reflection to invoke the Main.main() with your parameterers. A comprehensive example of which can be found here.