Flatpaks can also be used to run CLI programs, but it requires using flatpak run
instead of using the apps standard CLI command. But you can create an alias and should work mostly the same way.
For example, I have neovim on my Debian laptop via flatpak. So in order to run it, you have to do
flatpak run io.neovim.nvim
You can create an alias for that command
alias nvim='flatpak run io.neovim.nvim'
And then you can use the nvim command as normal
Sounds like you had a corrupt installation.