With xdotool, using xdotool getactivewindow set_desktop_for_window 4294967295 will pin a window, setting it to all desktops (technically, it is setting it to desktop -1). This is the same behavior as right clicking in the task bar and choosing "Move to Desktop > All Desktops."
Proposed new argument:
kdotool getactivewindow set_desktop --all
Action: Pins the selected window(s) to all desktops.
Side thought (possibly impossible): I do not know if KDE on Wayland supports more than one, but not all desktops, but this might be a good opportunity to allow set_desktop 1,3,4 to set it to Desktops 1, 3, and 4 but not 2 or 5.