How and when is 做 used as the verb "to be"?
"做" has a meaning of "充当，担任" (serves as, work as) (from 现代汉语词典 Modern Chinese Dictionary). It is different from "是" (to be).

The nuance of English and Chinese here is a little different. In Chinese, we don't say "I don't want to be [a slave]" (我不愿是[奴隶]). It is always "I don't want to serve as (become, etc.) a slave" (我不愿做(成为)奴隶).