Buffon’s needle assumes a flat space, while a non-Euclidean space or geometry would affect the probability leading to a different value other than pi. You can treat the space around us as Euclidean, but that isn’t true for every part of the universe.
Even in a non-Euclidean space with positive or negative curvature, the limit of the ratio of the circumference to the diameter of a circle as the diameter goes to zero is pi.