This issue was addressed through improved state management. This issue is fixed in macOS Ventura 13.7.2, macOS Sonoma 14.7.2. A user with screen sharing access may be able to view another user's screen.
https://support.apple.com/en-us/121842
https://support.apple.com/en-us/121840