Sampling and Filtering
Can I expect alias on the signals used in the control task of 20 kHz?

Yes. The 500kHz signal could have have signals up to 200kHz in it. It would get aliased when re-sampled for feeding into 20kHz.

Should in this case a digital filter at the sampling rate of 500 kHz applied that has a maximal cutoff frequency of 10 kHz (Half of control task rate)?

Yes. You can have a digital anti-aliasing filter running at 500kHz sitting upstream of the 20kHz control task.

Would it be possible to apply a further low pass filter with 10 kHz cutoff frequency in the 20 kHz program task?

(Emphasis mine). By the time you are inside the 20kHz, task, the aliasing would have already occured. (Unless you passed multiple, consecutive samples of the 500kHz signal inside the task, in which case the information loss hasn't occured yet). So, the digital anti-aliasing filter should be sitting upstream of the task.