isKeyDown true if sustain pedal is pressed?

I played a note (pressed a key), then pressed sustain pedal without releasing the key, then released the key holding the pedal and eventually unpressed the pedal reading isKeyDown for my previously pressed key. Surprisingly it returned me true, despite the physical key had been already released. Is it really so that isKeyDown counts a key being pressed (not released) if sus pedal is down?

Yes. If you use onRelease then you’ll see that it is called after you release the sustain pedal, not immediately after releasing the key.

However you can change this behaviour by turning off the sustain.

onRelease will be called immediately after you release the key and isKeyDown will return false. But then you need to handle the sustain pedal yourself.