Witnessing nonclassicality beyond quantum theory