This problem should be that the frequency of your optical coupler can't meet your requirements. Please check the data manual of that optical coupler to see what the highest frequency can be when it works normally.
Generally, the frequency of optical couplers is not very high. Optocouplers used for PWM isolation or communication are called high-speed optocouplers, and their prices are different.