I do believe that a fighter aircraft SHOULD have an onboard, built in gun. It is a poor tactical decision to have to use it, but to be in a situation where you need one and don’t have it is even worse.
There are only so many missiles to expend - when they are gone and enemy planes to be attacked there is the gun.