Instability-induced pattern formation of photoactivated functional polymers