It can be considered to run the wires through the flush-mounting box and to cut the excessively long wires to an appropriate length to obtain more space.
2. It can be considered to place it on the ceiling, but it must remain as far as possible from the bright and heating parts of the light.
3. It can be envisaged to increase the depth of the recessed box by a deeper box.