Windows 10 lets you remove the Pin to taskbar and Unpin from taskbar options in two ways.
Choose the method you prefer.
Go to User Configuration > Administrative Templates > Start Menu and Taskbar.
Double-click Do not allow pinning programs to the Taskbar.
Select Enabled and click OK.
Restart your PC.
That’s all. The “Pin to taskbar” and “Unpin from taskbar” options will no longer appear in the context menu.
These options can be added to the context menu by following the steps above, but selecting Disabled or Not Configured.
Navigate to HKEY_CURRENT_USER > Software > Policies > Microsoft > Windows.
Hit the Explorer key.
If you can’t find it, create it by right-clicking on the Windows key, and then selecting New > Key. Enter Explorer and then press Enter.
Right-click on a blank space in the right pane. Select New > DWORD (32-bit) Value. Enter NoPinningToTaskbar as the name, then press Enter.
Double-click it. Type 1 in the Value data field and press the OK button.
Restart your PC or File Explorer.
That’s all. From now on, you cannot pin to or unpin from the taskbar.
Note that you can add these options to the context menu by deleting the DWORD you’ve created or changing the value from 1 to 0.