The US detail is the one most founders get wrong. Software is not one of the nine work made for hire categories, so paying a contractor does not make you the owner without a written assignment. Many people assume the invoice settles it.
Your second point, the repository in an account the company controls, matters as much as the contract in practice. A signed assignment does not help much if the code, the cloud account and the domain all sit with the vendor when the relationship ends.
At Ascendra Ventures our FAQ answers this before anyone asks: on completion the client owns the code, the infrastructure configuration, the documentation and the data. The one thing we keep is the right to describe the engagement in anonymised form unless agreed otherwise. Writing it down that plainly has saved a lot of awkward conversations late in a project.
Have you seen disputes come more from the assignment wording itself, or from open-source licences found in the code afterwards?