[1.7.x] Fixed #23799 -- Made makemigrations respect --no-optimize.

Thanks to yamila-moreno for the idea of a skip message.

Backport of d18810131995dac63f9d89b0beaeadfc935130aa from master