The obvious solution: Create an insanely elaborate Ninja Warrior-esque obstacle course for the squirrel. Clearly.
Mark Rober got to the Ninja Warrior point after testing out multiple "squirrel proof" bird feeders and watching them fail spectacularly in the face of some ridiculously smart rodents. That (and most probably the boredom of coronavirus quarantine) inspired him to take things a little further.
Rober goes to insane lengths to make sure his obstacle course is squirrel proof. There are mazes, rope bridges, catapults... this thing is like Mouse Trap times a million. But if the squirrel successfully completes the course, they are given unfettered access to a massive pile of walnuts.
Incredibly the squirrels found ways to break the course, forcing Rober to adapt multiple times during this course of this video, which you absolutely should watch.