This has been a problem long before Godel: famously, Newton tried to get credit for inventing Calculus only after Leibniz published his work, leading to a bitter dispute that lasted long after they both died.
I wonder if this problem is now going to be significantly exacerbated by AI, as mathematicians are getting more incentives to keep their works secret —
— or, to the contrary, the community will get a push to publish incomplete ideas, scratch work, etc. early to establish a record of thinking about a problem before others did.
In the end, as always, it's a social problem created by " publish or perish " institutional incentives which reward (and require!) published results, but not the work that led to to them.
This, I hope, will finally change.