hailourtruegod said:
As a pet owner, you are basically trying to recreate every aspect of health that the animal would otherwise receive from its life in the wild. As you can imagine, this is very hard to do. The only thing humans do right is by giving them easy to constant food and water (even if it is of mediocre quality). Everything else, such as exercise, proper health, fresh air/sun, ability to roam and play... these are all very neglected.
Animals need exercise and mental stimulation every single day to be happy and healthy. This can be fulfilled with play feeders and regular play with toys, taking them on walks. This sounds easy enough, but it may require 15-30 minutes per day. Add this on top of everything else that needs to be done, and it easily gets sidelined. Then the dog or cat becomes a "bad boy" because it had to get rid of energy built up over weeks.
Furthermore, some animals like cats genuinely need some alone time. I remember watching this video of a cat that was so fed up by being constantly prodded by its owners for snuggles. In addition, they never played with the cat. The owners remarked how much calmer the cat was after it went outside. The cat was finally able to sit peacefully and/or explore. Besides its owners, it was also able to get away from loud (for a cat) noises like the kitchen appliances, the TV, loud talking or laughter, etc.
The point is that to keep your pet truly happy, you need to invest lots of thought, effort, and money. You cannot just sit them in a room and feed them dried soy and rice bits for their whole life. Expect to put it anywhere from 30 minutes to an hour of time per day spent petting, playing, or cleaning up after them.
As far as apartment living goes, yes this is a big problem. Having a play feeder, cat tower, cat perches, window or balcony access, lots of toy playing, etc can mitigate this. Lastly, putting a cat on a leash and walking them around the complex a couple times per week can get rid of the wanderlust. All of this takes time, however, so make sure you are willing to provide this.