Nonmonotonic behavior of the anisotropy coefficient in superconductor-ferromagnet-superconductor trilayers