Your method of taking ownership of the directory instead of changing its permissions to 777 is more secure in many contexts.
Many systems have default umasks of 022. When a directory is created, the umask is usually subtracted from 777 to calculate the permissions of the new directory, meaning the default directory permissions on most systems are 755. This means that by default, only a directory's owner may create and delete files within it. Other users are not prevented from writing to files within that directory though. That protection is provided by the files' permissions. You should be aware that if a user has write permissions to a directory but not to a file within that directory, they can simply delete the file and replace it.
In summary, taking ownership of the directory instead of changing its permissions to 777 will prevent other users from adding, removing, or replacing files within that directory but will not prevent users from reading files within the directory.
A note on directory permissions
Directory permissions are slightly odd and unintuitive compared to file permissions. The executable permission (
1) allows you to retrieve metadata for files within a directory, including the files' inodes. This means that without execution permissions for a directory, you cannot read files within that directory knowing only the files' paths. The read permission (
4) allows you to see a list of files in a directory but not their metadata. The write permission (
2) allows you to create and delete files within a directory.