In Linux, when we install any software requiring changes to the firewall rules to open or allow certain network ports in iptable, is this done automatically by the package manager or part of the installation routine?
Depends. Almost all softwares that I work with does not setup firewall rules by themselves. The basics of firewall control is IPTABLES. This package is found in both user space and kernel space. This is mostly the portion you interact intimately controlling network traffics besides iproute2, tc, ifconfig etc...
Now there is also FIREWALLD and UFW which does more integration which allows of applications to provide firewall rules profiles when they are installed into the system. But to my knowledge, I have not witness a lot of utilities providing profiles, mostly because I work with development utilities most of the time, not some consumer office suites.