Installing Ruby with rbenv won’t break macOS or replace the system Ruby.
What does stand out is that you installed Ruby 4.0.6, but ruby -v reports 3.4.5. If this is inside your Rails project, that’s likely because the project has a .ruby-version file pinning Ruby 3.4.5.
Could you open a terminal in the Rails project and post the output of:
pwd
ls -la
rbenv versions
rbenv version
ruby -v
cat .ruby-version