Does musescore fit your needs? If you want a piano.. you should probably get a midi input keyboard. If you don’t need 88 keys and real-time playing, you can deal with less octaves.
I've never dived into this, but if electronic keyboards are just glorified midi-controllers, I'd have to think you could find a FOSS solution. If they're not simply midi-controllers, I wouldn't begin to know. I'd imagine you might have an easier time with keyboards from the 90s or whenever.
I guess the closest to a decent FOSS piano plugin is MDA Piano, or perhaps search for piano samples. Perhaps someone has created a decent piano preset for the dexed FM synth (but will probably sound very 80s). I'm using pianoteq (unfortunately proprietary, but it has native linux support and sounds good).
I've used Ardour to capture keyboard midi input before. Not beginner-friendly, but it works if you want to play something, pick a soundfile, edit a flubbed note or two, and add it to a project.
Not quite sure what you're after - but on the off chance, I'll mention LMMS, as I don't think it's already been mentioned amongst the other audio software.