The Pashtun code of revenge against the wrongdoers became a proverb in India.
John Briggs in 1829 writes: “Afghan revenge has become proverbial in India . It is said , a man is never safe from the revenge of an elephant , a nag ( the cobra snake), or an Afghan”.
So this famous saying in the Rambo III movie is not original or creative writing by some Hollywood writer. It is based on an old proverb from India.
Note that in 19th century the word Afghan was exclusively used in the meaning of Pashtun and it also covered the Pashtuns of those regions which are now part of Afghanistan.